2015-03-19 52 views
0

我有以下问题:WSO2ESB并行SOAP调用

开发一个基于WSDL的代理,在并行调用几个不同的SOAP Web服务并返回响应:

<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文本端点关键:端点

我知道这可能是一个新手的问​​题,但我有一个困难时期关于这一主题找到好的教程。

谢谢

回答

1

当您设置属性(范围默认值)在序列中,您可以在排序中找到它的值。

将此属性设置您在序列里面:

<property name="IN_MESSAGE_ID" expression="get-property('MessageID')"/> 

您可以使用get-property('IN_MESSAGE_ID')在输出序列

如果你想将消息发送到一个动态的地址,你可以设置头“To”并使用发送中介:

<header name="To" expression="get-property('MY_DESTINATION')"/> 
<send/> 
+0

谢谢。几分钟前我得出了同样的结论 – 2015-03-19 15:49:03

0

尝试设置邮件ID作为HTTP标头属性,

<header name="MessageId" value="0001" scope="transport"/> 

而在outSequence

<property name="MessageId" expression="get-property('MessageId')"/> 

我havnt测试了这一点检索这个头,所以给个反馈是否有效

+0

不幸的是,所做的只是将这些元素添加到SOAP标头中。我需要将它们保存在wso2esb中,并在收到响应后回复消息 – 2015-03-19 13:02:54