/
Configuring the Recurly Fault Handler Sequence
This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Configuring the Recurly Fault Handler Sequence
The following section includes a sample proxy, and its fault handler sequence is shown below.
Note: This will not be working at its state; therefore, it needs to be customized as per the requirement.
Sample Proxy
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="Recurly_sampleProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence onError="faultHandlerSeq"> <init> </init> <filter source="$axis2:HTTP_SC" regex="^[^2][0-9][0-9]"> <then> <switch source="$axis2:HTTP_SC"> <case regex="401"> <!--Fill with your error code value and expression--> <property name="ERROR_CODE" value=""/> <property name="ERROR_MESSAGE" value | expression /> </case> <case regex="422"> <property name="ERROR_CODE" value=""/> <property name="ERROR_MESSAGE" value | expression/> </case> <case regex="404"> <property name="ERROR_CODE" value=""/> <property name="ERROR_MESSAGE" value | expression/> </case> <case regex="403"> <property name="ERROR_CODE" value=""/> <property name="ERROR_MESSAGE" value | expression/> </case> <case regex="400"> <property name="ERROR_CODE" value=""/> <property name="ERROR_MESSAGE" value | expression/> </case> <case regex="500"> <property name="ERROR_CODE" value=""/> <property name="ERROR_MESSAGE" value | expression/> </case> <default> <property name="ERROR_CODE" expression="$axis2:HTTP_SC"/> <property name="ERROR_MESSAGE" value | expression/> </default> </switch> <sequence key="faultHandlerSeq" /> </then> </filter> <respond /> </inSequence> <outSequence> <send></send> </outSequence> </target> </proxy>
faultHandlerSeq
<sequence xmlns="http://ws.apache.org/ns/synapse" name="faultHandlerSeq"> <property xmlns:ns="http://org.apache.synapse/xsd" name="contentTypeValue" expression="get-property('transport', 'Content-Type')"></property> <filter xmlns:ns="http://org.apache.synapse/xsd" xpath="get-property('contentTypeValue') = 'application/json' or get-property('contentTypeValue') = 'text/json'"> <then> <payloadFactory media-type="json"> <format> {"error_code":"$1", "error_message":"$2"} </format> <args> <arg expression="get-property('ERROR_CODE')" evaluator="xml"></arg> <arg expression="get-property('ERROR_MESSAGE')" evaluator="xml"></arg> </args> </payloadFactory> <property name="messageType" value="application/json" scope="axis2"></property> </then> </filter> <filter xmlns:ns="http://org.apache.synapse/xsd" xpath="get-property('contentTypeValue') = 'application/xml' or get-property('contentTypeValue') = 'text/xml'"> <then> <payloadFactory media-type="xml"> <format> <error_info> <error_code>$1</error_code> <error_message>$2</error_message> </error_info> </format> <args> <arg expression="get-property('ERROR_CODE')" evaluator="xml"></arg> <arg expression="get-property('ERROR_MESSAGE')" evaluator="xml"></arg> </args> </payloadFactory> <property name="messageType" value="text/xml" scope="axis2"></property> </then> </filter> <respond></respond> </sequence>
, multiple selections available,
Related content
Configuring the Drupal Fault Handler Sequence
Configuring the Drupal Fault Handler Sequence
More like this
Configuring the SharePoint Fault Handler Sequence
Configuring the SharePoint Fault Handler Sequence
More like this
Configuring the GoToTraining Fault Handler Sequence
Configuring the GoToTraining Fault Handler Sequence
More like this
Configuring the Constant Contact Fault Handler Sequence
Configuring the Constant Contact Fault Handler Sequence
More like this
Configuring the ExactTarget Fault Handler Sequence
Configuring the ExactTarget Fault Handler Sequence
More like this
Configuring the FreeAgent Fault Handler Sequence
Configuring the FreeAgent Fault Handler Sequence
More like this