Skip to content

Instantly share code, notes, and snippets.

@fjunior87
Created May 19, 2019 23:45
Show Gist options
  • Save fjunior87/87216852dce7699110a4abd0e6c2f251 to your computer and use it in GitHub Desktop.
Save fjunior87/87216852dce7699110a4abd0e6c2f251 to your computer and use it in GitHub Desktop.
WSO2 Calculator API for Unit Text Example
<?xml version="1.0" encoding="UTF-8"?>
<api context="/calculator" name="CalculatorAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/add/{number1}/{number2}">
<inSequence>
<!-- Build Request -->
<sequence description="Validating the input data" key="UnitTestExample_Validation_Sequence"/>
<filter regex="FAILURE" source="get-property('VALIDATION_RESULT')">
<then>
<sequence key="UnitTestExample_BuildFailureResponse_Sequence"/>
</then>
<else>
<sequence key="UnitTestExample_BuildRequestPayload_Sequence"/>
<!-- Send to Service -->
<sequence key="UnitTestExample_SendRequest_Sequence"/>
<sequence key="UnitTestExample_BuildResponsePayload_Sequence"/>
<!-- build response payload -->
</else>
</filter>
<log level="full">
<property expression="$ctx:VALIDATION_RESULT" name="ValidationResult"/>
</log>
<!-- Check if it was a failure - build error payload -->
<!-- Else build request payload and send it -->
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment