Pages

Sunday, July 5, 2015

Invoking Fault Sequence for SOAPFaults in WSO2 ESB

In WSO2 Enterprise Service Bus Synapse configuration provides ability to execute set of instruction when some fault occurred within mediation flow by with the help of faultSequence. It's similar catch block to try-catch in JAVA. We can bind faultSequence with ESB proxies, API's etc.

Generally faultSequence get executed for errors, exception in mediation flow, such as trying to process malformed xml, endpoint timeout, any mediation errors, etc. It is not designed to execute  when error response get received. But you can set property to execute faultSequence when a standards soap fault (SOAPFault) response received from an endpoint. It becomes handy in service chaining because we do not need to check and verify for fault response before calling the next endpoint.

You can force to execute faultSequence by setting "FORCE_ERROR_ON_SOAP_FAULT" property to "true"

<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true" scope="default" type="STRING"/>

Sample synapse configuration to depict usage of  FORCE_ERROR_ON_SOAP_FAULT



In above sample simply front echo service which comes by default with WSO2 ESB. If you call "echoProxy" which echo service returns SOAPFault such as sending alphabetical character for echoInt operation, you can see the fault sequence "echoFaultSeq" get executed.


No comments:

Post a Comment