Created
August 8, 2020 00:29
-
-
Save edgars/94bc0e665a26158a76fc31835b27651a to your computer and use it in GitHub Desktop.
Handling-Errors-EI-API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<sequence name="sequence-fault" trace="disable" xmlns="http://ws.apache.org/ns/synapse"> | |
<log level="full"> | |
<property name="text" value="An unexpected error occured"/> | |
<property name="message" expression="get-property('ERROR_MESSAGE')"/> | |
</log> | |
<payloadFactory media-type="xml"> | |
<format> | |
<error xmlns=""> | |
<msg>$1</msg> | |
</error> | |
</format> | |
<args> | |
<arg evaluator="xml" expression="get-property('ERROR_MESSAGE')"/> | |
</args> | |
</payloadFactory> | |
<property name="HTTP_SC_DESC" value="Error in the Enterprise Integrator Layer" scope="axis2"/> | |
<property name="messageType" scope="axis2" type="STRING" value="application/json"/> | |
<respond/> | |
</sequence> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<api context="/ob" name="skalena-api" xmlns="http://ws.apache.org/ns/synapse"> | |
<resource methods="POST"> | |
<inSequence> | |
<log> | |
<property expression="json-eval($.menu.id)" name="menuID ==== > "/> | |
</log> | |
<property expression="json-eval($.menu.id)" name="menuID" scope="default" type="STRING"/> | |
<filter regex="file" source="$ctx:menuID"> | |
<then> | |
<call-template target="template-message-response"> | |
<with-param name="msg" value="Payload is OK"/> | |
</call-template> | |
</then> | |
<else> | |
<makefault description="Error" version="soap11"> | |
<code value="soap11Env:VersionMismatch" xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/"/> | |
<reason value="The Tag Menu is not file"/> | |
<detail>The menu expected is file and only file .</detail> | |
</makefault> | |
</else> | |
</filter> | |
<respond/> | |
</inSequence> | |
<outSequence/> | |
<faultSequence> | |
<sequence key="sequence-fault"/> | |
</faultSequence> | |
</resource> | |
</api> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<template name="template-message-response" xmlns="http://ws.apache.org/ns/synapse"> | |
<parameter name="msg"></parameter> | |
<sequence> | |
<log level="custom"> | |
<property name="LOG_MESSAGE" expression="$func:msg" /> | |
</log> | |
<payloadFactory media-type="xml"> | |
<format> | |
<status xmlns=""> | |
<msg>$1</msg> | |
</status> | |
</format> | |
<args> | |
<arg evaluator="xml" expression="$func:msg"/> | |
</args> | |
</payloadFactory> | |
<property name="messageType" value="application/json" scope="axis2"/> | |
</sequence> | |
</template> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment