Sunday, 13 August 2017

SOAPException: faultCode=SOAP-ENV:Client; msg=For input string: "3773 "; targetException=java.lang.NumberFormatException ~ foundjava

I get this warning with JMeter
WARN - jmeter.protocol.http.sampler.WebServiceSampler: [SOAPException: faultCode=SOAP-ENV:Client; msg=For input string: "3773 "; targetException=java.lang.NumberFormatException: For input string: "3773 "]
every time I try to test a web service by running a WebService(SOAP) Request. Strange it might seem, but I found out that the error is actually a network error; to be more specific an HTTP/1.1 504 Proxy Timeout ( The connection timed out. ). The original error is totally misleading.
The connection times out, so I get no SOAP response back. What I get though is the headers, the content and the content length back. But for some reason the content length is padded with some spaces at the end and when the HTTPUtils (the class that handles the SOAP request/response) tries to parse it with this statement
Integer.parseInt(value);
it fails. I had to rebuild jmeter and step through it with breakpoints in order to see what’s going on. The solution is as simple as adding a trim to the statement (a couple of lines above the offending statement):
String value = valuebuf.toString().trim();
This fixes the issue and you get the actual response back which is
Error Code 10060: The gateway could not receive a timely response from the website you are trying to access. This might indicate that the network is congested, or that the website is experiencing technical difficulties..

No comments:

Post a Comment