Hi Madhuranga, Thank you for the sample. There is actually full envelope body in your example. Using your sample I was able to understand what cause an empty envelope in onError sequence.
if you add just two additional parameters to the endpoint: <timeout> <duration>5000</duration> <responseAction>fault</responseAction> </timeout> So that endpoint timeout becomes 5 seconds and after timeout an error must be thrown (otherwise error sequence is not called) and point an endpoint to some url which is actually reply after more than 5 seconds... For example, I achieve timeout using this simple php script: <?php ob_start(); sleep(40); header("Content-type: text/xml;charset=ISO-8859-1"); echo '<methodResponse>XXX</methodResponse>'; ob_end_flush(); ?> In this case, when timeout occurs, I get empty envelope... log file sample, with configured timeout: [2015-11-16 22:15:10,982] INFO - LogMediator To: /services/InOnlyProxy.InOnlyProxyHttpSoap12Endpoint, MessageID: urn:uuid:90c7f86d-d11a-4b13-a058-82c9900fefc4, Direction: request, retry_count = null, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"<http://schemas.xmlsoap.org/soap/envelope/>><soapenv:Body/></soapenv:Envelope> [2015-11-16 22:15:10,987] WARN - TimeoutHandler Expiring message ID : urn:uuid:8358adc3-08e7-425b-ab62-3419a477439a; dropping message after timeout of : 5 seconds [2015-11-16 22:15:25,978] INFO - LogMediator To: /services/InOnlyProxy.InOnlyProxyHttpSoap12Endpoint, MessageID: urn:uuid:01b3c6df-ed0d-4ab5-82fd-5630fb24a115, Direction: request, retry_count = 1, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"<http://schemas.xmlsoap.org/soap/envelope/>><soapenv:Body/></soapenv:Envelope> [2015-11-16 22:15:25,980] WARN - TimeoutHandler Expiring message ID : urn:uuid:caacc0ec-5750-4580-9eb6-27be7b593be2; dropping message after timeout of : 5 seconds [2015-11-16 22:15:37,416] WARN - SynapseCallbackReceiver Synapse received a response for the request with message Id : urn:uuid:8358adc3-08e7-425b-ab62-3419a477439a But a callback is not registered (anymore) to process this response [2015-11-16 22:15:40,978] INFO - LogMediator To: /services/InOnlyProxy.InOnlyProxyHttpSoap12Endpoint, MessageID: urn:uuid:9561bc27-15aa-4523-bf26-404761983f11, Direction: request, retry_count = 2.0, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"<http://schemas.xmlsoap.org/soap/envelope/>><soapenv:Body/></soapenv:Envelope> [2015-11-16 22:15:40,979] WARN - TimeoutHandler Expiring message ID : urn:uuid:80fdc5ae-b31f-42c6-9be6-358c93d8bb4a; dropping message after timeout of : 5 seconds If I deploy the same project to 4.8.1 the SOAP body is not lost. However, in 4.9.0 SOAP body is not available.. So the question is why there is such a difference? is it done on purpose? for the reference, my endpoint xml: <endpoint name="SimpleStockQuoteService" xmlns=<http://ws.apache.org/ns/synapse>"http://ws.apache.org/ns/synapse"<http://ws.apache.org/ns/synapse>> <address uri="http://localhost/index.php"<http://localhost/index.php>> <timeout> <duration>5000</duration> <responseAction>fault</responseAction> </timeout> <suspendOnFailure> <errorCodes>-1</errorCodes> <progressionFactor>1.0</progressionFactor> </suspendOnFailure> <markForSuspension> <errorCodes>-1</errorCodes> </markForSuspension> </address> </endpoint> Thanks in advance, Nariman. On 11/15/2015 08:53 AM, Madhuranga Bandara wrote: Hi Nariman, I have tried this in a ESB 4.9.0 fresh pack. Given below is my ESB configuration. I could access the SOAP envelop from "SimpleSQFault" onError sequence. <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://ws.apache.org/ns/synapse"> <registry provider="org.wso2.carbon.mediation.registry.WSO2Registry"> <parameter name="cachableDuration">15000</parameter> </registry> <taskManager provider="org.wso2.carbon.mediation.ntask.NTaskTaskManager"/> <proxy name="InOnlyProxy" startOnLoad="true" trace="disable" transports="https http"> <target> <inSequence> <property name="target.endpoint" value="SimpleStockQuoteService"/> <sequence key="SimpleSQSender"/> </inSequence> <outSequence> <send/> </outSequence> </target> </proxy> <endpoint name="SimpleStockQuoteService"> <address uri="http://127.0.0.1:9000/services/SimpleStockQuoteService"> <suspendOnFailure> <errorCodes>-1</errorCodes> <progressionFactor>1.0</progressionFactor> </suspendOnFailure> <markForSuspension> <errorCodes>-1</errorCodes> </markForSuspension> </address> </endpoint> <sequence name="SimpleSQFault"> <log level="full"> <property expression="get-property('retry_count')" name="retry_count" xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd"/> </log> <filter xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" xpath="get-property('retry_count')"> <then> <property expression="number(get-property('retry_count'))+1" name="retry_count" scope="default"/> <filter xpath="get-property('retry_count') > 10"> <then> <log> <property expression="get-property('retry_count')" name="Dropping--Count"/> </log> <drop/> </then> </filter> </then> <else> <property name="retry_count" scope="default" value="1"/> <clone continueParent="true"> <target> <sequence> <makefault version="soap11"> <code value="tns:Receiver" xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/> <reason expression="get-property('ERROR_MESSAGE')"/> </makefault> <send/> <drop/> </sequence> </target> </clone> </else> </filter> <clone> <target> <sequence> <store messageStore="SimpleMS"/> </sequence> </target> </clone> </sequence> <sequence name="SimpleSQSender" onError="SimpleSQFault"> <send> <endpoint key="SimpleStockQuoteService"/> </send> </sequence> <sequence name="fault"> <!-- Log the message at the full log level with the ERROR_MESSAGE and the ERROR_CODE--> <log level="full"> <property name="MESSAGE" value="Executing default 'fault' sequence"/> <property expression="get-property('ERROR_CODE')" name="ERROR_CODE"/> <property expression="get-property('ERROR_MESSAGE')" name="ERROR_MESSAGE"/> </log> <!-- Drops the messages by default if there is a fault --> <drop/> </sequence> <sequence name="main"> <in> <!-- Log all messages passing through --> <log level="full"/> <!-- ensure that the default configuration only sends if it is one of samples --> <!-- Otherwise Synapse would be an open proxy by default (BAD!) --> <filter regex="http://localhost:9000.*" source="get-property('To')"> <!-- Send the messages where they have been sent (i.e. implicit "To" EPR) --> <send/> </filter> </in> <out> <send/> </out> <description>The main sequence for the message mediation</description> </sequence> <messageStore name="SimpleMS"/> <messageProcessor class="org.apache.synapse.message.processor.impl.sampler.SamplingProcessor" messageStore="SimpleMS" name="Processor"> <parameter name="interval">3000</parameter> <parameter name="sequence">SimpleSQSender</parameter> </messageProcessor> <!-- You can add any flat sequences, endpoints, etc.. to this synapse.xml file if you do *not* want to keep the artifacts in several files --> </definitions> Given below is the ESB Console output. You can see that the soap envelop can be access from onError sequence. This goes up to count 10. I have attached only part of it. Try it using different SOAP envelop. [2015-11-15 10:10:08,814] WARN - ConnectCallback Connection refused or failed for : /127.0.0.1:9000<http://127.0.0.1:9000> [2015-11-15 10:10:08,817] INFO - LogMediator To: /services/InOnlyProxy, WSAction: urn:getQuote, SOAPAction: urn:getQuote, MessageID: urn:uuid:63621a67-6906-48eb-af86-b8ee617d2afa, Direction: request, retry_count = null, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://services.samples/xsd" xmlns:ser="http://services.samples"><soapenv:Body> <ser:getQuote> <ser:request> <xsd:symbol>WSO2</xsd:symbol> </ser:request> </ser:getQuote> </soapenv:Body></soapenv:Envelope> [2015-11-15 10:10:11,176] WARN - ConnectCallback Connection refused or failed for : /127.0.0.1:9000<http://127.0.0.1:9000> [2015-11-15 10:10:11,177] INFO - LogMediator To: /services/InOnlyProxy, WSAction: urn:getQuote, SOAPAction: urn:getQuote, MessageID: urn:uuid:ca4e81a3-8dac-4e86-a845-f251a48353de, Direction: request, retry_count = 1, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="<http://schemas.xmlsoap.org/soap/envelope/>http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body> <ser:getQuote xmlns:ser="<http://services.samples>http://services.samples"> <ser:request> <xsd:symbol xmlns:xsd="<http://services.samples/xsd>http://services.samples/xsd">WSO2</xsd:symbol> </ser:request> </ser:getQuote> </soapenv:Body></soapenv:Envelope> Thanks, Madhuranga. Madhuranga Sampath Bandara Software Engineer WSO2, Inc.;http://wso2.com/<http://www.google.com/url?q=http%3A%2F%2Fwso2.com%2F&sa=D&sntz=1&usg=AFQjCNGJuLRux6KkJwXKVUCYOtEsNCmIAQ> lean.enterprise.middleware Mobile: +94722241065 On Fri, Nov 13, 2015 at 6:45 PM, Nariman Abdullayev (TD) <<mailto:itana...@azercell.com>itana...@azercell.com<mailto:itana...@azercell.com>> wrote: Hi, I have a registered onError sequence. In version 4.8.1 SOAP envelop is available in onError sequence while in 4.9.0 it is not. in order to access SOAP message content in 4.9.0 after error (in onError sequence) I always have to copy it to some temp variable initially. it is very inconvenient. could it be a bug or is it a new "feature" of 4.9.0? this is my fault sequence. if i remove enrich mediator envelope comes empty from the sequence with an error. Without enrich mediator message contains empty soap envelope. It can be seen in the output of the log mediator and in the message stored in RabbitMQ backend. Actually, it is onError sequence of XXXXNotifySendSequence sequence (I added them both for the reference). in case of failure I store the message in an external queue, then using sampling message I processor read messages from queue and to process them again. the idea is taken from - http://charith.wickramaarachchi.org/2012/05/another-message-redelivery-pattern-with.html <?xml version="1.0" encoding="UTF-8"?> <sequence name="XXXXNotifyErrorSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse"<http://ws.apache.org/ns/synapse>> <log level="full"> <property name="mssg" expression="get-property('mssg')"/> <property name="retry_count" expression="get-property('retry_count')"/> </log> <filter xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"<http://www.w3.org/2003/05/soap-envelope> xpath="get-property('mssg')"> <then> <enrich> <source clone="true" property="mssg" type="property"/> <target type="envelope"/> </enrich> <property name="mssg" action="remove"/> </then> <else/> </filter> <filter xmlns:ns="http://org.apache.synapse/xsd"<http://org.apache.synapse/xsd> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"<http://www.w3.org/2003/05/soap-envelope> xmlns:ns3="http://org.apache.synapse/xsd"<http://org.apache.synapse/xsd> xpath="get-property('retry_count')"> <then> <property name="retry_count" expression="number(get-property('retry_count'))+1" scope="default" type="STRING"/> <filter xpath="get-property('retry_count') > 5"> <then> <log> <property name="Dropping--Count" expression="get-property('retry_count')"/> </log> <drop/> </then> <else> <sequence key="XXXXNotifySendSequence"/> </else> </filter> </then> <else> <property name="retry_count" value="1" scope="default" type="STRING"/> <clone continueParent="true"> <target> <sequence> <makefault version="soap11"> <code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/"<http://schemas.xmlsoap.org/soap/envelope/> value="soap11Env:VersionMismatch"/> <reason expression="get-property('ERROR_MESSAGE')"/> </makefault> <send/> </sequence> </target> </clone> </else> </filter> <clone> <target> <sequence> <log level="custom"> <property name="STORE" value="store the message"/> </log> <store messageStore="XXXXRabbitMQNative"/> </sequence> </target> </clone> </sequence> this is the sequence calling onError sequence. I emulate http timeout in HTTPEndpoint to trigger onError sequence invocation <?xml version="1.0" encoding="UTF-8"?> <sequence name="XXXXNotifySendSequence" onError="XXXXNotifyErrorSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse"<http://ws.apache.org/ns/synapse>> <log level="full"> <property name="XXXX" value="request start"/> </log> <enrich> <source clone="true" type="envelope"/> <target property="mssg" type="property"/> </enrich> <property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/> <call> <endpoint key="HTTPEndpoint"/> </call> <log level="full"> <property name="XXXX" value="request end"/> </log> </sequence> Nariman. _______________________________________________ Dev mailing list Dev@wso2.org<mailto:Dev@wso2.org> http://wso2.org/cgi-bin/mailman/listinfo/dev
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev