这是我的代理代码:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="ProviderPublication" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<filter xmlns:p="http://www.openoandm.org/xml/ISBM/" xpath="//p:OpenPublicationSession">
<then>
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="ChannelURI" expression="//xs:ChannelURI" scope="default" type="STRING"/>
<class name="wso2.org.Communicator.OpenPublication">
<property name="channelURI" value="myChannelURI"/>
</class>
**<property name="sessionIDFromClassMediator" expression="get-property('SessionID')" scope="default" type="STRING"/>**
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<payloadFactory>
<format>
<ns1:OpenPublicationSessionResponse xmlns:ns1="http://www.openoandm.org/xml/ISBM/">
<ns1:SessionID>$1</ns1:SessionID>
</ns1:OpenPublicationSessionResponse>
</format>
<args>
<arg expression="get-property('sessionIDFromClassMediator')"/>
</args>
</payloadFactory>
<send/>
</then>
<else>
<filter xpath="//p:PostPublication">
<then>
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="SessionID" expression="//xs:SessionID" scope="default" type="STRING"/>
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="Topic" expression="//xs:Topic" scope="default" type="STRING"/>
<property xmlns:xs="http://www.openoandm.org/xml/ISBM/" name="Expiry" expression="//xs:Expiry" scope="default" type="STRING"/>
<property xmlns:ns="http://www.openoandm.org/xml/ISBM/" name="MessageContent" expression="//MessageContent" scope="default" type="STRING"/>
<class name="wso2.org.postPublication.PostPublication">
<property name="topic" value="Sports"/>
<property name="sessionID" value="session_001"/>
<property name="messagecontent" value="Cricket on air"/>
<property name="expiry" value="Monday"/>
</class>
<property name="getMessageIDFromClassMed" expression="get-property('MessageID')" scope="default" type="STRING"/>
<log level="full">
**<property name="SessionIDFromFstFltr" expression="get-property('sessionIDFromClassMediator')"/>**
</log>
我无法获得 sessionIDFromClassMediator 的属性值,所以我的过滤器永远不会正确并且无法进入过滤器
**<filter xpath="get-property('sessionIDFromClassMediator') = get-property('SessionID')">
<then>
<log level="custom">
<property name="STATE" value="message is sent to queue"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<payloadFactory>
<format>
<ns1:PostPublicationResponse xmlns:ns1="http://www.openoandm.org/xml/ISBM/">
<ns1:MessageID>$1</ns1:MessageID>
</ns1:PostPublicationResponse>
</format>
<args>
<arg expression="get-property('getMessageIDFromClassMed')"/>
</args>
</payloadFactory>
<send/>
</then>
<else>
<log level="full">
<property name="FilterNotRunning" value="----------FilterNotRunning------------------"/>
</log>
<drop/>
</else>
</filter>**
</then>
<else>
<drop/>
</else>
</filter>
</else>
</filter>
</inSequence>
<endpoint>
<address uri="jms:/myQueue?&transport.jms.DestinationType=queue"/>
</endpoint>
所以我想得到的值,<property name="sessionIDFromClassMediator" expression="get-property('SessionID')" scope="default" type="STRING"/>
以便我可以使用这个属性值来匹配其他属性
<class name="wso2.org.postPublication.PostPublication">
<property name="topic" value="Sports"/>
<property name="sessionID" value="session_001"/>
<property name="messagecontent" value="Cricket on air"/>
<property name="expiry" value="Monday"/>
</class>
之后我向消息代理发送消息,但在此之前我想关联一个应该发送到消息代理队列的有效负载。我想在里面实现有效载荷
我无法获得 sessionIDFromClassMediator 的属性值,所以我的过滤器永远不会正确并且无法进入过滤器
**<filter xpath="get-property('sessionIDFromClassMediator') = get-property('SessionID')">
<then>
<log level="custom">
<property name="STATE" value="message is sent to queue"/>
</log>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
<header name="To" action="remove"/>
<property name="RESPONSE" value="true" scope="default" type="STRING"/>
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
<payloadFactory>
<format>
<ns1:PostPublicationResponse xmlns:ns1="http://www.openoandm.org/xml/ISBM/">
<ns1:MessageID>$1</ns1:MessageID>
</ns1:PostPublicationResponse>
</format>
<args>
<arg expression="get-property('getMessageIDFromClassMed')"/>
</args>
</payloadFactory>
<send/>
</then>
<else>
<log level="full">
<property name="FilterNotRunning" value="----------FilterNotRunning------------------"/>
</log>
<drop/>
</else>
</filter>**
部分。主要问题是,当我调用操作 OPENPUBLICATION 时执行第一个过滤器,而当我调用第二个操作时,所有属性值都得到重置。那么,我怎样才能使财产价值保持不变,使其永不丢失?希望您能理解我的问题并期待您的解决方案。提前致谢