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
[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
[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/";><soapenv:Body>
      <ser:getQuote xmlns:ser="http://services.samples";>
         <ser:request>
            <xsd:symbol xmlns: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) <
[email protected]> 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
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to