Forum Discussion
SOAP HTTP Monitor - HTTP Error 400. The request has an invalid header name.
Hello All
I am new to SOAP testing, I am using an http monitor to do a SOAP test but I keep receiving error 400 from the server. I am using a 3rd party SOAP client which gets a successful response, and it's using the same statement. I believe the problem is how I am constructing the request. I have read http://support.f5.com/kb/en-us/solutions/public/2000/100/sol2167.html but still don't understand why this is failing.
This is what I am using on the 'Send String' portion of the test:
POST /CurrencyConvertor.asmx HTTP/1.1\r\nAccept-Encoding: gzip,deflate\r\nContent-Type: text/xml;charset=UTF-8\r\nSOAPAction: \"http://www.webserviceX.NET/ConversionRate\"\r\nContent-Length: 345\r\nHost: www.webservicex.com\r\nConnection: Keep-Alive\r\nUser-Agent: Apache-HttpClient/4.1.1 (java 1.5)\r\n\r\r\n\r\n\r\n\r\nEUR\r\nAFA\r\n\r\n\r
The Wireshark capture from my tests indicates:
POST /CurrencyConvertor.asmx HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "http://www.webserviceX.NET/ConversionRate" Content-Length: 345 Host: www.webservicex.com Connection: Keep-Alive
EUR AFA
HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Fri, 04 Oct 2013 23:04:50 GMT Connection: close Content-Length: 339
Bad Request Bad Request - Invalid Header
HTTP Error 400. The request has an invalid header name.
The Wireshark from the successful connection using 3rd party shows:
POST /CurrencyConvertor.asmx HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "http://www.webserviceX.NET/ConversionRate" Content-Length: 345 Host: www.webservicex.com Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
EUR AFA HTTP/1.1 200 OK Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Encoding: gzip Vary: Accept-Encoding Server: Microsoft-IIS/7.0 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Fri, 04 Oct 2013 22:24:10 GMT Content-Length: 311
0
I'd really appreciate any advice, many thanks….
G
FYI I am using BIP-IP VE version 10.1.0
- Kevin_StewartEmployee
I'm curious about the extra line feeds. You should only have two line feeds ("\r\n\r\n") between the headers and the payload, and you shouldn't need any after the payload. You can also test a POST request from the command line with cURL.
curl -v -H "header=something" -H "header=something" http://1.1.1.1/uri -d "user=foo&pass=bar"
- Gus_135027Cirrus
Thanks Kevin,
I followed your advice about using curl. It's working now, more or less....
I now get the string that I am looking for: < ConversionRateResult >0< /ConversionRateResult >
However now get a code 200 OK followed by a 400 error, so something still not perfect but the test is working.
The final version of this string is:
POST /CurrencyConvertor.asmx HTTP/1.1\r\nHost: 173.201.44.188\r\nAccept: */*\r\nContent-Length: 299\r\nContent-Type: text/xml;charset=UTF-8\r\n\r\nEURAFA
The Wireshark output is now:
HTTP/1.1 200 OK Cache-Control: private, max-age=0 Content-Length: 377 Content-Type: text/xml; charset=utf-8 Server: Microsoft-IIS/7.0 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Sat, 05 Oct 2013 21:58:06 GMT
< ConversionRateResult >0< /ConversionRateResult >HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Sat, 05 Oct 2013 21:58:06 GMT Connection: close Content-Length: 311
Bad Request Bad Request
HTTP Error 400. The request is badly formed.
- Kevin_StewartEmployee
Nothing immediately stands out except maybe not having to escape double quotes. Is it failing with cURL, the monitor, or both?
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com