Error: “HTTP Status-Code=400 (Bad Request)…” when replaying a Web script

Error: "HTTP Status-Code=400 (Bad Request)…" when replaying a Web script

The following error occured when replaying a Web script:

"HTTP Status-Code=400 (Bad Request) for "https//xxx/…."

Compare the sent request with the recorded request for missing header fields

A HTTP 400 Error indicates that the HTTP SEND request has malformed syntax and/or that the request could not be understood by the server. If you do not have this problem on recording, and start receiving this error even if you run one Vuser, then it is very likely that the HTTP SEND request by LoadRunner was an incomplete one.

To further debug this problem:
1. Run the script with the Extended log with all the three options checked.

2. Compare the HTTP SEND request from the Execution Log with the similar request sent while recording. Copy both these header requests in a Notepad file and compare them. Look for the header statements that are present in the Recording Log (for Single Protocol) or Generation Log (for Multiple Protocol) but missing in the Execution Log as these are usually the culprit.

Example:

If you get HTTP Status-Code=400 (Bad Request) errors while replaying Outlook Web Access 2000 Script, typically the headers of Depth, Translate and Content-Type are found to be missing for Outlook application.

3. Add the missing header with a web_add_header("xxxxx","yyyy"); statement right before the web statement that failed in the script and try to replay the script.

4. If you observe that this particular header statement is missing from all the HTTP SEND requests, add a web_add_auto_header(xxxxx","yyyy"); statement right at the beginning of the script. With web_add_auto_header, you would not need to add this statement before every HTTP SEND request.

5. There is one more alternative, go to Tools -> Recording Options -> Advanced tab, click on the "Headers" button, select "Record Headers in the List," then select "xxxxx" so it will ensure that you will be able to record this statement while recording itself. If the "xxxxx" option is not available as a header, use suggestions 3 or 4 to resolve the issue.

Advertisements

2 thoughts on “Error: “HTTP Status-Code=400 (Bad Request)…” when replaying a Web script

  1. Fred

    Thanks so much for this article! I missed the following Header “Request-Header-Length” and after adding it all my problems were solved!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s