问题
I'm sending a message with a Proxy to a HL7 TCP/IP port and get the response in the outSequence. But my problem is that all properties set in the inSequence are not anymore available. All of them are null. I tested with all the different scopes (transport, axis2, axis2-client), but none of them worked.
I saw in this post that it should be possible. Is the HL7 sender destroying the properties? How can use my properties from the inSequence in the outSequence?
Example of my Proxy (get message from ActiveMQ JMS and sends to HL7 port 4000):
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" xmlns:hl7="http://wso2.org/hl7" xmlns:urn="urn:hl7-org:v2xml" name="demo_toHL7" transports="jms" startOnLoad="true" trace="disable">
<parameter name="transport.jms.Destination">demo_qFilter</parameter>
<parameter name="transport.jms.ConnectionFactory">queueBlocking</parameter>
<parameter name="transport.jms.DestinationType">queue</parameter>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/edi-hl7</default>
</rules>
</parameter>
<target faultSequence="rollbackSequence">
<inSequence>
<log level="full"/>
<property name="ClientApiNonBlocking" scope="axis2" action="remove"/>
<property name="testProperty" value="blabla" scope="transport"/>
<property name="messageType" value="application/edi-hl7" scope="axis2"/>
<property name="ContentType" value="application/edi-hl7" scope="axis2"/>
<send>
<endpoint>
<address uri="hl7://localhost:4000"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="custom">
<property name="PROPERTY" expression="get-property('transport','testProperty')"/>
</log>
</outSequence>
</target>
</proxy>
I'm using WSO2 ESB 4.0.3 and installed the HL7 Feature. As receiver I use the 7edit application.
回答1:
Try with property scope as "default/synapse"
FiveO edit comment:
Try with property scope as "default":
Sending a transport property from the inSequence to the outSequence (on behalf of the default scope):
<inSequence>
...
<property name="myPropertyInTransport" value="myValue" scope="transport"/>
<property name="myPropertyInDefault" expression="get-property('transport','myPropertyInTransport')" scope="default"/>
...
</inSequence>
<outSequence>
...
<property name="myPropertyInTransport" expression="get-property('default', 'myPropertyInDefault')" scope="transport"/>
<!-- Now myProperty is also available in the outSequence -->
...
</outSequence>
来源:https://stackoverflow.com/questions/13377837/pass-property-from-insequence-to-outsequence