Make multiple calls for a single endpoint

Not applicable

We have a request to make 3 calls on the same endpoint and concatenate the answers to have only one answer. With a general timeout if we do not have an answer for one of the 3 requests.


We want to make a REST to SOAP to REST, for that we have 3 WSDL.

What is the best practice to implement this use case. Give us the answer through a practical example?


explanatory diagram attached

4634-screen-shot-2017-04-10-at-54001-pm.png

0 1 1,189
1 REPLY 1

There are a several approaches to achieve this.

  1. Use multiple ServiceCallout policies, wrapping each with other policies to prepare the requests and extract values from the response (e.g. AssignMessage/ExtractVariables). You can see an example here (not SOAP, but the same pattern applies)
  2. An extension of the above approach with focus on keeping the proxy DRY. If your 3 requests are similar, you could define a Shared Flow that is responsible for preparing and sending your requests, as well as handling the response by extracting the data you need. Shared Flows can be invoked using a FlowCallout policy
  3. It's also possible to use a single JavaScript policy to perform all 3 requests, although this may not be the most appropriate solution if you're working with SOAP services (XML). It's worth understanding the Apigee Edge JavaScript object model if going down this route; specifically the section on using the provided HTTP client. I'd also recommend reviewing the cookbook topics covering the use of JS in a proxy and a more detailed example of using the HTTP client. Another introductory example is available here.

Whichever approach is taken, implementing robust error handling and thoroughly testing the proxy is important.