Wso2 ESB GET PROXY NAME

感情迁移 提交于 2021-01-28 06:24:38

问题


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?


回答1:


This will return proxy name.

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



回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/12300816/wso2-esb-get-proxy-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!