将属性从inSequence传递给outSequence

时间:2012-11-14 11:21:26

标签: wso2 wso2esb hl7 synapse

我正在向HL7 TCP / IP端口发送带有代理的消息,并在outSequence中获取响应。但我的问题是inSequence中设置的所有属性都不再可用。所有这些都是空的。我测试了所有不同的范围(transport,axis2,axis2-client),但没有一个工作。

I saw in this post that it should be possible。 HL7发送器是否会破坏属性? 如何在outSequence中使用inSequence中的属性?

我的代理示例(从ActiveMQ JMS获取消息并发送到HL7端口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>

我正在使用WSO2 ESB 4.0.3并安装了HL7功能。作为接收者,我使用7edit应用程序。

1 个答案:

答案 0 :(得分:4)

尝试将属性范围设为“default / synapse”

FiveO编辑评论:

尝试使用属性范围作为“默认”:

将inSequence中的传输属性发送到outSequence(代表默认范围):

<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>
相关问题