Soap to Rest proxy (SOAP - REST - SOAP)

snowamigos
Participant II

Usecase: Currently we have a vendor who can't call a RESTfull endpoint, So now we need to build a soap proxy which needs to convert the XML payload to JSON then post it to a RESTfull endpoint.

Does anyone have any thoughts on how to implement this proxy?

Does anyone have any examples or samples/articles?

Please let me know if you need more information.

Solved Solved
0 1 815
1 ACCEPTED SOLUTION

Apigee Edge acts as a smart configurable proxy, and it is designed to do the kind of thing that you describe.

There are multiple ways to solve your problem. The main challenge is transforming the SOAP/XML to JSON on the inbound request flow, and then transform the JSON to SOAP/XML on the response flow.

Apigee Edge includes 4 policies that can assist in the required transformations.

  • XMLToJSON to convert arbitrary XML to JSON
  • JSONToXML to do the converse
  • XSL to transform XML to XML
  • JavaScript to transform JSON to JSON

There are multiple ways to solve your problem, but the most common way is to use XMLToJSON on the request flow, and then apply a JS policy to transform the resulting JSON into the shape/structure your backend requires. And then on the response flow, JSONtoXML, and an XSL. The reason you need that second JS step or XSL step is because the transformation typically needs to be customized.

(If you don't care for XSL, then you can do the response transform with a JS step followed by JSONToXML )

For examples, I would suggest searching for examples using THOSE ^^ policies. There are plenty of existing videos, screencasts, and example bundles.

View solution in original post

1 REPLY 1

Apigee Edge acts as a smart configurable proxy, and it is designed to do the kind of thing that you describe.

There are multiple ways to solve your problem. The main challenge is transforming the SOAP/XML to JSON on the inbound request flow, and then transform the JSON to SOAP/XML on the response flow.

Apigee Edge includes 4 policies that can assist in the required transformations.

  • XMLToJSON to convert arbitrary XML to JSON
  • JSONToXML to do the converse
  • XSL to transform XML to XML
  • JavaScript to transform JSON to JSON

There are multiple ways to solve your problem, but the most common way is to use XMLToJSON on the request flow, and then apply a JS policy to transform the resulting JSON into the shape/structure your backend requires. And then on the response flow, JSONtoXML, and an XSL. The reason you need that second JS step or XSL step is because the transformation typically needs to be customized.

(If you don't care for XSL, then you can do the response transform with a JS step followed by JSONToXML )

For examples, I would suggest searching for examples using THOSE ^^ policies. There are plenty of existing videos, screencasts, and example bundles.