简体   繁体   English

Mule ESB使用多个REST服务

[英]Mule ESB Consume Multiple REST Services

My API name is A, and I have to call 2 REST services in my API. 我的API名称是A,我必须在我的API中调用2个REST服务。

I was able to call one REST service, and tried calling 2nd REST service using Scatter-Gather but no luck. 我能够调用一个REST服务,并尝试使用Scatter-Gather调用第二个REST服务,但没有运气。

Here is my flow diagram for calling single REST service 这是我调用单个REST服务的流程图 在此输入图像描述

Based on service response, I am using Choice and transforming message to my Service schema and things are cool up to this point, but I have few fields left in my schema, those need to fetched from other REST call. 基于服务响应,我使用Choice并将消息转换为我的服务模式,到目前为止很酷,但是我的模式中还有很少的字段,需要从其他REST调用中获取。 So.., How can i consume two REST services and transform them into my API schema? 那么..,我如何使用两个REST服务并将它们转换为我的API模式?

在此输入图像描述

I have tried with scatter-gather, first call POST and second call is GET and I was able to map some details from first and some details from second REST call to my API schema, but How can I display my final output ? 我尝试使用scatter-gather,第一次调用POST,第二次调用是GET,我能够将第一个和第二个REST调用的一些细节映射到我的API模式,但是如何显示我的最终输出?

Thanks 谢谢

You can do this by using Variable transformers to store the results of the calls. 您可以使用Variable变换器来存储调用结果。 I was able to achieve something similar using the following: 我能够使用以下方法实现类似的功能: 图片

Note the use of sub-flows, each of which start with an HTTP Request Connector. 请注意子流的使用,每个子流都以HTTP请求连接器开头。

I'd be happy to clarify anything here if needed, just let me know! 如果需要,我很乐意在这里澄清一下,请告诉我!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM