0
votes

I have a fault sequence being called from a proxyService whenever there is a fault or exception. Since this fault sequence is common to all proxy services, how can extract which proxyService called the fault sequence?

For example, ProxyService A has a fault, and calls "faultSequence". within the FaultSequence code, how do i detect that it was indeed called by ProxyService A and not another proxyService?

I have tried a few different things like extracting headers, To, From, log mediators etc. but i am unable to get any value in my logs.

I also see that a simple send mediator (send mediator with no endpoint or address) responds to the calling proxy service, so the fault sequence must know where to send the message i.e. where the message came from in the first place. Looking at the documentation: https://docs.wso2.com/display/ESB460/Send+Mediator, it says that the message is sent to wsa:To but i am unable to extract that value into a property or in the logs. appreciate your help.

Thanks

1

1 Answers

1
votes

You can find the proxy service that have been called looking at a property named "To" : <property name="PROXY_NAME" expression="get-property('To')"/>

If you log it like this :

<log level="custom">
  <property name="ProxyName" expression="get-property('PROXY_NAME')"/>
</log>

you should have something like "services/MyProxyName"

By default, send mediator without endpoint reference send back the current response to the caller, but you can send the current message to a dynamic address setting the header "To". A sample to send the current message to http://host:port/myService :

<header name="To" value="http://host:port/myService"/>
<send/>

If you want to send back a dummy response inside a inSequence, you must remove header "To" :

<header name="To" action="remove"/>
<property name="RESPONSE" value="true"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<payloadFactory>
    <format>
        <ns:getQuoteResponse xmlns:ns="http://services.samples">
            ...
        </ns:getQuoteResponse>
    </format>
</payloadFactory>
<send/>