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/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Following is a sample proxy service and fault handler sequence you can use as a starting point for handling faults when integrating with Reddit. Customize this sample to match your requirements.

Sample Proxy
<proxy xmlns="http://ws.apache.org/ns/synapse" name="reddit_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>
  • No labels