HTTP 500 and a SOAP Fault during replay of a Web Service script
When testing a well known Web Service using a Vugen 9.5 script created with a WSDL import, the error returned may not be handled by Vugen if the data specified is invalid. With the correct data supplied to the Web Service the Vugen Web Service script replays without error. However, in certain test cases the Web Service returns an HTTP 500 with a SOAP Fault; for example, on a call to the service with a non-existent account number. This causes the Vugen replay to fail with the following messages displayed in the Vugen Replay log:
Action.c(6): HTTP/1.0 500 Internal Server Error
Action.c(6): X-Backside-Transport: FAIL FAIL
Action.c(6): Server: Apache-Coyote/1.1
Action.c(6): SoapAction: "http://xxx.yyy.com/xxxx/yyyyy/Recognition-v1/wsdl/Recognition"
Action.c(6): Content-Type: text/xml
Action.c(6): Date: Mon, 30 Nov 2009 07:19:48 GMT
Action.c(6): X-Client-IP: xx.xx.xx.xx
Action.c(6): Connection: Keep-Alive
Action.c(6): Content-Length: 1454
Action.c(6): Error Exceptions:
Action.c(6): System.Exception: Soap error:
Message:bad cin value : contract not found
Mercury.LR.LrWsNetClient.ProxyCreator.InvokeMethod(String sMethod, IWSMethodParameters mParams, String sAsyncEvent)
Mercury.LR.LrWsNetClient.NetReplay.InvokeMethod(String sMethod, IWSMethodParameters mParams, String sAsyncEvent)
Action.c(6): Error: <CENTER><STRONG><FONT COLOR=#FF0031>Expected SOAP result, received SOAP fault</FONT></STRONG></CENTER>
Action.c(6): Error: <CENTER><STRONG><FONT COLOR=#FF0031>Failed to retrieve output arguments/checkpoints – SOAP fault occurred</FONT></STRONG></CENTER>
How can Vugen handle the SOAP Fault and the HTTP 500 so that the Web Service script can be used to test the service response to invalid data?
An HTTP 500 error is generated by the Web Server when there is an irrecoverable error, but it can also be generated when there is a SOAP Fault, i.e. when a problem is detected at the application level. This behavior is documented in http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383529
In this particular case a non-existent account number is passed to the application through the Web Service resulting in both an HTTP 500 and a SOAP Fault response from the server.
Testing a Web Service with deliberately unknown or invalid data is referred to as “negative testing”. By default the web_service_call in a Vugen Web Services script uses positive testing, i.e. the script will fail if there is a SOAP Fault returned by the server.
To change the default behavior to allow the script to handle the SOAP Fault, change the web_service_call to accept ANY response from the server by including the argument "ExpectedResponse=AnySoap".
The actual error code or message sent by the application (e.g. "Invalid Account Number") can then be retrieved from the SOAP response by calls to lr_xml_find and lr_xml_get_values within the script.