wso2 esb:从多个Web服务调用构造一条消息 [英] wso2 esb: Construct one message from multiple web service calls

查看:85
本文介绍了wso2 esb:从多个Web服务调用构造一条消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多Web服务,每个Web服务都返回如下用户ID列表:

I have a number of web services each returning a list of user ids as follows:

<application name="abc">
   <users>
     <id>123</id>
     <id>456</id>
     <id>789</id>
   </users>
</application>

我需要能够


  1. 调用具有特定ID(例如123)的代理服务;

  2. 调用每个Web服务并搜索ID;

  3. 为每个Web服务创建一个响应,最后

  4. 将所有响应汇总为一条消息,如下所示:

  1. Call a proxy service with a specific id (for example 123);
  2. Call each webservice and search for the ID;
  3. Create a response for each webservice and finally
  4. Aggregate all responses in one message which is sent to the client as follows:







<response>
  <id>123</id>
  <application name="abc">
      found
  </application>
  <application name="lmn">
      not found
  </application>
  <application name="xyz">
      found
  </application>
</response>

它可能是服务链接和聚合的结合,但我不知道该怎么做。我尝试克隆一个请求,并在最后使用发送和接收序列,该序列使用有效负载工厂来转换主体。然后在Out序列中,我使用aggregation组合新消息。但是它超时了,我认为这不是时间问题。我的主要问题是如何从每个Web服务响应中创建一个新消息,聚合介体可以将它们组合在一起。

Its probably a mix of service chaining and aggregate, but I cannot figure out how to do it. I tried cloning a request and using send at the end with a receiving sequence which transforms the body using the payload factory. In the Out sequence I then used aggregate to combine the new messages. However it times out and I don't think it's a matter of timing. My main issue is how to create a new message from each webservice response the aggregate mediator can combine them.

我们将不胜感激。

谢谢

推荐答案

您需要遵循以下模式, https://docs.wso2.com/display/IntegrationPatterns/Scatter-Gather ,您就快到了。当您定义接收序列时,响应将被存储在该序列中,并且您不会在outSequence中收到响应消息。

You need to follow this pattern, https://docs.wso2.com/display/IntegrationPatterns/Scatter-Gather and you are almost there. When you define receive sequence the response will be forwareded to that sequence and you wouldn't get the response message in outSequence. Use aggregator mediator inside the outSequence and Combine the responses rather than defining a receive sequence.

一旦聚合了响应,就可以使用xslt中介器来转换消息。

Once you aggregate the responses, you can use xslt mediator to transform the message.

这篇关于wso2 esb:从多个Web服务调用构造一条消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆