Skip to content

Instantly share code, notes, and snippets.

@rnavagamuwa
Created February 2, 2021 06:52
Show Gist options
  • Save rnavagamuwa/4a085f01239fe7695b77cb0f10797dd7 to your computer and use it in GitHub Desktop.
Save rnavagamuwa/4a085f01239fe7695b77cb0f10797dd7 to your computer and use it in GitHub Desktop.
<sequence xmlns="http://ws.apache.org/ns/synapse" name="custom_validation">
<log description="validation_flow_initiated_log" level="custom">
<property name="validation_flow_initiated_log" value="Custom valiation initiated" />
</log>
<payloadFactory description="sample_submission_payload" media-type="json">
<format>{"scope":"$1","service":"$2"}</format>
<args>
<arg evaluator="xml" expression="$ctx:Scopes" />
<arg evaluator="xml" expression="get-property('transport','service')" />
</args>
</payloadFactory>
<call blocking="true">
<endpoint>
<http method="post" uri-template="http://localhost:8595/api/validate">
<timeout>
<duration>60000</duration>
<responseAction>fault</responseAction>
</timeout>
</http>
</endpoint>
</call>
<filter regex="false" source="json-eval($.validated)">
<then>
<log description="validation_failed_log" level="custom">
<property name="validation_failed_log" value="Validation failed" />
</log>
<respond />
</then>
<else />
</filter>
</sequence>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment