【问题标题】:Pass property from inSequence to outSequence将属性从 inSequence 传递到 outSequence
【发布时间】:2012-11-02 21:22:57
【问题描述】:

我正在向 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 应用程序。

【问题讨论】:

    标签: wso2 wso2esb hl7 synapse


    【解决方案1】:

    尝试将属性范围设置为“默认/突触”

    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>
    

    【讨论】:

    • 否 - 我收到此错误:org.apache.synapse.SynapseException: 属性中介的属性范围只允许使用“axis2”或“transport”或“axis2-client”值,不支持范围默认/突触
    • 你是如何定义范围的?
    • 谢谢我能够通过将“默认”范围内的属性发送到 outSequence 来实现结果。我会用一些例子来修改你的答案。
    • 谢谢..我在答案中添加了您的评论
    • @Ratha 我需要使用类调解器发送字符串值作为响应。这是我的问题stackoverflow.com/questions/45132859/…。您对此有任何想法吗?谢谢
    猜你喜欢
    • 1970-01-01
    • 2013-11-13
    • 1970-01-01
    • 2018-09-21
    • 2017-02-10
    • 2015-11-13
    • 2012-02-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多