我正在根据 URL 进行过滤,所以我想知道我收到的请求来自哪个服务。意味着我想知道客户端的 URL
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Emp" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="username" expression="//username/text()" scope="default" type="STRING"/>
<property name="password" expression="//password/text()" scope="default" type="STRING"/>
<payloadFactory>
<format>
<send xmlns="">
<username>$1</username>
<password>$2</password>
</send>
</format>
<args>
<arg expression="get-property('username')"/>
<arg expression="get-property('password')"/>
</args>
</payloadFactory>
<send receive="Emp_Seq">
<endpoint>
<address uri="http://192.168.1.65:8282/services/Login"/>
</endpoint>
</send>
</inSequence>
<outSequence/>
</target>
<description></description>
</proxy>
URL of above Proxy is http://192.168.1.65:8282/services/Emp
我的第二个代理将基于第一个代理执行一些逻辑
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Login" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="client_ip_address" expression="get-property('axis2','REMOTE_ADDR')" scope="default" type="STRING"/>
<property name="username" expression="//username/text()" scope="default" type="STRING"/>
<property name="password" expression="//password/text()" scope="default" type="STRING"/>
<property name="From" expression="get-property('From')"/>
<property name="Address" expression="get-property('To')"/>
<filter xmlns:ns="http://org.apache.synapse/xsd" xpath="get-property('From')='/services/Emp'">
<then>
<payloadFactory>
<format>
<ResponseJSON xmlns="">
<Status>404</Status>
<Exception>Not Found</Exception>
<Total>0</Total>
</ResponseJSON>
</format>
</payloadFactory>
<send/>
</then>
<else>
<payloadFactory>
<format>
<p:login xmlns:p="http://authentication.services.core.carbon.wso2.org">
<p:username>$1</p:username>
<p:password>$2</p:password>
<p:remoteAddress>$3</p:remoteAddress>
</p:login>
</format>
<args>
<arg expression="//username/text()"/>
<arg expression="//password/text()"/>
<arg expression="get-property('client_ip_address')"/>
</args>
</payloadFactory>
<header name="Action" value="urn:login"/>
<log level="full"/>
<send receive="Login_Seq">
<endpoint>
<address uri="https://192.168.1.65:9443/services/AuthenticationAdmin" format="soap11"/>
</endpoint>
</send>
</filter>
</inSequence>
<outSequence>
<log level="full"/>
</outSequence>
</target>
<description></description>
</proxy>
问题是 get-property('To') 给了 Address=/services/Login 而 get-property('From') 给了 senderAddress=null 我如何管理这个我尝试了很多属性,即使它不是像工作
一样
<property name="senderAddress" expression="get-property('transport', 'From')"/>
<property name="Sender Address" expression="$url:From"/>
<header name="From" expression="get-property( 'From')"/>
<property name="PRESERVE_WS_ADDRESSING" value="true"/>
<property xmlns:wsa="http://www.w3.org/2005/08/addressing" name="$header" expression="$header/wsa:From"/>
此属性也不起作用我们在 wso2 esb 中没有任何选项如果您知道这一点,请大致编辑我的代理..它的简单 depending 逻辑但它在 WSO2 中不起作用提前谢谢