WSO2ESB 并行 SOAP 调用
WSO2ESB Parallel SOAP calls
我有以下问题:
开发一个基于 WSDL 的代理,它并行调用多个不同的 SOAP Web 服务和returns 响应:
<inSequence>
<log level="full"/>
<iterate xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:agg="http://www.test.ro/aggregate"
preservePayload="true"
attachPath="//soapenv:Body"
expression="//agg:AggregateRequest/agg:messageRequest">
<target>
<sequence>
<property name="messageId"
expression="//soapenv:Body/agg:messageRequest/agg:messageId[node()]"/>
<property name="endpoint"
expression="//soapenv:Body/agg:messageRequest/agg:endpoint[node()]"/>
<xslt key="CleanPayload" source="/"/>
<send>
<endpoint key="MirrorEndpoint"/>
</send>
</sequence>
</target>
</iterate>
</inSequence>
<outSequence>
<property name="resp" scope="default">
<agg:AggregateResponse xmlns:agg="http://www.test.ro/aggregate"/>
</property>
<aggregate>
<completeCondition timeout="10">
<messageCount min="-1" max="-1"/>
</completeCondition>
<onComplete xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
expression="$body/*"
enclosingElementProperty="resp">
<log level="full"/>
<send/>
</onComplete>
</aggregate>
</outSequence>
我的挑战是:
- 如何将 messageId 从 inSequence 传递到 outSequence 以便我可以将响应与请求相匹配(类似于 Message Broker 的本地环境)
- 如何使用 agg:endpoint
中的文本设置端点密钥
我知道这可能是一个新手问题,但我很难找到关于这个主题的好教程。
谢谢
尝试将 messageId 设置为 HTTP header 属性,
<header name="MessageId" value="0001" scope="transport"/>
并在 outSequence
中检索此 header
<property name="MessageId" expression="get-property('MessageId')"/>
我还没有测试过这个,所以请就它是否有效提供反馈
当您在 In Sequence 中设置 属性(范围默认值)时,您可以在 Out Sequence 中找回它的值。
在您的 In Sequence 中设置此 属性 :
<property name="IN_MESSAGE_ID" expression="get-property('MessageID')"/>
您可以在输出序列中使用 get-property('IN_MESSAGE_ID')
如果要向动态地址发送消息,可以设置 "To" header 并使用发送中介:
<header name="To" expression="get-property('MY_DESTINATION')"/>
<send/>
我有以下问题:
开发一个基于 WSDL 的代理,它并行调用多个不同的 SOAP Web 服务和returns 响应:
<inSequence>
<log level="full"/>
<iterate xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:agg="http://www.test.ro/aggregate"
preservePayload="true"
attachPath="//soapenv:Body"
expression="//agg:AggregateRequest/agg:messageRequest">
<target>
<sequence>
<property name="messageId"
expression="//soapenv:Body/agg:messageRequest/agg:messageId[node()]"/>
<property name="endpoint"
expression="//soapenv:Body/agg:messageRequest/agg:endpoint[node()]"/>
<xslt key="CleanPayload" source="/"/>
<send>
<endpoint key="MirrorEndpoint"/>
</send>
</sequence>
</target>
</iterate>
</inSequence>
<outSequence>
<property name="resp" scope="default">
<agg:AggregateResponse xmlns:agg="http://www.test.ro/aggregate"/>
</property>
<aggregate>
<completeCondition timeout="10">
<messageCount min="-1" max="-1"/>
</completeCondition>
<onComplete xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
expression="$body/*"
enclosingElementProperty="resp">
<log level="full"/>
<send/>
</onComplete>
</aggregate>
</outSequence>
我的挑战是:
- 如何将 messageId 从 inSequence 传递到 outSequence 以便我可以将响应与请求相匹配(类似于 Message Broker 的本地环境)
- 如何使用 agg:endpoint 中的文本设置端点密钥
我知道这可能是一个新手问题,但我很难找到关于这个主题的好教程。
谢谢
尝试将 messageId 设置为 HTTP header 属性,
<header name="MessageId" value="0001" scope="transport"/>
并在 outSequence
中检索此 header<property name="MessageId" expression="get-property('MessageId')"/>
我还没有测试过这个,所以请就它是否有效提供反馈
当您在 In Sequence 中设置 属性(范围默认值)时,您可以在 Out Sequence 中找回它的值。
在您的 In Sequence 中设置此 属性 :
<property name="IN_MESSAGE_ID" expression="get-property('MessageID')"/>
您可以在输出序列中使用 get-property('IN_MESSAGE_ID')
如果要向动态地址发送消息,可以设置 "To" header 并使用发送中介:
<header name="To" expression="get-property('MY_DESTINATION')"/>
<send/>