There's a requirement to customise the response code validation for a HTTP request operation to have different error handling for each scenario. For example, to treat certain scenarios as a successful or unsuccessful response regardless of the response status code received.
A good example here's the WSC Connector. It uses HTTP request operation either implicitly (by default) or explicitly (in customised configuration). The problem arises from the fact that, the HTTP transport propagates all response codes to the WSC Connector to make a decision on how to treat the response. In some cases, the connector can receive several different faulty responses. For example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <soapenv:Fault> <faultcode>Server</faultcode> <faultstring>Missing operation for soapAction [http://www.cleverbuilder.com/BookService/GetBook] and body element [{http://www.cleverbuilder.com/BookService/}GetBook1] with SOAP Version [SOAP 1.1]</faultstring> </soapenv:Fault> </soapenv:Body></soapenv:Envelope>
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <con:fault xmlns:con="http://example.com/context"> <con:errorCode>SOME_ERROR</con:errorCode><!-- TRUNCATED --> </con:fault> </soap:Body></soapenv:Envelope>
By default, or when a response validator is set as explained in this article, both SOAP_FAULT and INTERNAL_SERVER_ERROR will be propagated to the WSC Connector. The connector, in turn, will catch the SOAP_FAULT, as expected, but skip the INTERNAL_SERVER_ERROR, which will be treated as a successful response with code 200.
To catch both responses with code 500 and ensure they produce different errors, an expression response validator can be used as:
<http:response-validator > <http:expression-response-validator expression="#[attributes.statusCode == 200 or (attributes.statusCode == 500 and read(payload, 'text/xml').Envelope.Body.fault.errorCode == null)]" /> </http:response-validator>
The above will allow it to propagate:
Note, the validator passes the validation if the final result of the expression execution is true.
Note, the complexity of identifying which expressions to use arises from the fact that any error within the HTTP transport may not be shown when the WSC Connector processes the error. To know what needs to be included into the exp[ression, as in the above example, it is recommended to:
Note, this may also be applicable to any connector which uses an HTTP connector as a transport and where the customised response validation is required.
005226745

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.