Question

I would like to know how can I get the name of the proxy in use in a sequence:

<proxy xmlns="http://ws.apache.org/ns/synapse" name="PROXYNAME" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <property> *GET-NAME OF THIS PROXY...* </property>
      </inSequence>
   </target>
   <publishWSDL uri="http://localhost/Test2/Service.asmx?wsdl" />
</proxy>

EDIT In order to get the Name of the proxy (which should be contained in the header 'To' I am trying this as inSequence of a proxy:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="testsequence">
   <property xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" name="p1" expression="$header/wsa:To" scope="default" />
   <log level="custom">
      <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd" name="***output" expression="get-property('p1')" />
   </log>
</sequence>

does not work, any suggestion please?

Was it helpful?

Solution 2

Solved with a very simple: get-property('To')

OTHER TIPS

This will return proxy name.

<log level="custom"> <property name="ProxyName" expression="$ctx:proxy.name"/></log>

Nuvio,

I'm just wondering what's the real requirement in doing this as the name of a particular proxy service remains static while a particular is completely served by the service. However, if you really want to do this, an easier way would be to have a static property (using property mediator) at the beginning of the sequence and have the proxy name assigned to it. Or you can probably extract the value of the "To" header by using the expression "$header/wsa:To" in which "wsa" corresponds to the relevant addressing namespace, and then write a regular expression to extract the service name.

Cheers, Prabath

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top