To capture the SOAP Fault thrown by the WebServices when configuring a separate/custom HTTP Request config to a Web Service Consumer connector.
We may be required to use a separate HTTP Request config instead of the default (HTTP Request used by default by WSC) to pass authentication information like configuring Basic Auth or configuring TLS.
Assume the WebService Consumer connector is Configured as below with a custom HTTP Request config.
<u>WebService Consumer Config</u> <wsc:config name="Web_Service_Consumer_Config" doc:name="Web Service Consumer Config" doc:id="e21aefba-c6a3-424f-a4bc-bb1cb38f35f4" > <wsc:connection soapVersion="SOAP12" wsdlLocation="endorsement.wsdl" service="EndorsementSearchService" port="GetEndorsingBoarderPort" address="http://localhost:8088/mockEndorsementSearchSoapBinding" > <wsc:custom-transport-configuration > <wsc:http-transport-configuration requesterConfig="HTTP_Request_configuration" /> </wsc:custom-transport-configuration> </wsc:connection> </wsc:config> <u>HTTP Request Configuration </u> <http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="2bbe39da-7ee0-4fbc-88f0-6dca9c27b6f1" > <http:request-connection host="localhost" port="8088" > <http:authentication > <http:basic-authentication username="yyy" password="xxx" /> </http:authentication> </http:request-connection> </http:request-config>
When calling the WSC Consume operation, if there is a soap fault returned by the operation the HTTP Request config masks that Soap fault and returns the 500 Internal Server Error, as below
ERROR 2020-09-17 14:23:46,751 [[MuleRuntime].uber.05: [test-wsc-config].test-wsc-configFlow.BLOCKING @4c81703e] [processor: ; event: 93529c00-f89d-11ea-9d24-8c8590bb32aa] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: ******************************************************************************** Message : HTTP POST on resource 'http://localhost:8088/mockEndorsementSearchSoapBinding' failed: internal server error (500). Element : test-wsc-configFlow/processors/2 @ test-wsc-config:test-wsc-config.xml:48 (Call service) Element DSL : <wsc:consume operation="GetEndorsingBoarder" doc:name="Call service" doc:id="0c1d6684-b29d-4a6e-9af2-5f6ce4f2d485" config-ref="Web_Service_Consumer_Config"> <wsc:message> <wsc:body>#[vars.requestBody]</wsc:body> </wsc:message> </wsc:consume> Error type : HTTP:INTERNAL_SERVER_ERROR FlowStack : at test-wsc-configFlow(test-wsc-configFlow/processors/2 @ test-wsc-config:test-wsc-config.xml:48 (Call service)) (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ********************************************************************************
This is because HTTP Requester is unable to validate the soap fault to the calling WSC as it doesn't know what is the response success status code. Hence "HTTP/1.1 500 Internal Server Error" is sent instead.
To overcome this issue and return the SOAP Fault to the caller, the HTTP Request config should be updated to pass the "http:response-validator" element as below
<http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="2bbe39da-7ee0-4fbc-88f0-6dca9c27b6f1" >
<http:request-connection host="localhost" port="8088" >
<http:authentication >
<http:basic-authentication username="admin" password="test" />
</http:authentication>
</http:request-connection>
<http:response-validator>
<http:success-status-code-validator values="100..500"/>
</http:response-validator>
</http:request-config>
After adding the http:response-validator, SOAP_FAULT is returned to the caller as expected
ERROR 2020-09-17 16:42:39,066 [[MuleRuntime].uber.07: [test-wsc-config].test-wsc-configFlow.BLOCKING @194fdd67] [processor: ; event: fa90d630-f8b0-11ea-af81-8c8590bb32aa] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: ******************************************************************************** Message : Endorsment Service Failure Element : test-wsc-configFlow/processors/2 @test-wsc-config:test-wsc-config.xml:51 (Call service) Element DSL : <wsc:consume operation="GetEndorsingBoarder" doc:name="Call service" doc:id="0c1d6684-b29d-4a6e-9af2-5f6ce4f2d485" config-ref="Web_Service_Consumer_Config"> <wsc:message> <wsc:body>#[vars.requestBody]</wsc:body> </wsc:message> </wsc:consume> Error type : WSC:SOAP_FAULT FlowStack : at test-wsc-configFlow(test-wsc-configFlow/processors/2 @test-wsc-config:test-wsc-config.xml:51 (Call service)) (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ********************************************************************************
If a more customised response validation is needed an Expression Response Validator can be used instead.
001115947

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.