Loading

Web Service Consumer Connector | How to Capture the SOAP Fault When Web Service Consumer Uses Separate HTTP Request Config

Data pubblicazione: Oct 17, 2025
Operazione

To capture the SOAP Fault thrown by the WebServices when configuring a separate/custom HTTP Request config to a Web Service Consumer connector.

Fasi

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)
********************************************************************************


 

Risorse aggiuntive

If a more customised response validation is needed an Expression Response Validator can be used instead.

Numero articolo Knowledge

001115947

 
Caricamento
Salesforce Help | Article