문제

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?

도움이 되었습니까?

해결책 2

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top