nuvio
nuvio

Reputation: 2625

Wso2 ESB GET PROXY NAME

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?

Upvotes: 1

Views: 1223

Answers (3)

Gihan Anuruddha
Gihan Anuruddha

Reputation: 339

This will return proxy name.

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

Upvotes: 3

nuvio
nuvio

Reputation: 2625

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

Upvotes: 2

Prabath Abeysekara
Prabath Abeysekara

Reputation: 1085

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

Upvotes: 0

Related Questions