Tutorial: Manual construction of a SOAP-to-REST API proxy in Apigee Edge

Apigee Edge has a WSDL Import "Wizard". You can paste in a WSDL URL, and click "Import" and Apigee Edge will generate an API Proxy. But sometimes, the generated proxy is not what you want.

Maybe some of the elements in the SOAP payload should be set to default values. Maybe all of the data items should be required as query params. Maybe you want the caller to pass them as part of a JSON request body. Maybe there is some combination of those things. Maybe you want to populate the defaults from a user profile. The WSDL Importer Wizard doesn’t ask you about any of these decisions, but a smart human wants those options.

Building an API facade yourself on top of an existing SOAP is probably the better way to go for that reason. We can call it "curating" an API.

Building a custom API facade might sound daunting at first, especially compared to the friendly "next...next...next..." experience of using a Wizard. But doing the custom work is really not so terribly difficult, and you can produce *exactly* what you want, rather than settling for something kinda close to what you want. The key tools in your toolbag for this task will be:

  • the ExtractVariables policy - this allows you to extract values from the inbound request, whether from the URI path, or from the JSON body, or from headers, etc.
  • The AssignMessage policy - this allows you to construct an XML / SOAP payload to send to the existing SOAP service.
  • the XMLToJSON policy - this converts the SOAP response from the backend into JSON

I've created a short screencast to show how it's done.

6597-screenshot-20180319-084506.png

You can open that video in a new tab by clicking here.

I'd love to hear comments from people on whether they find this approach helpful.

Comments
eduardoandrade
New Member

Great post!

Thanks

ankita10j
Participant II

Hi Dino,

I have created an API which is taking soap XML as request and sending JSON to my backend and then again converting json to XML.

Its basically SOAP - REST -SOAP.

Consumer application which is based out of SOAP needs WSDL from apigee to consume it. Is it a way by which I can provide them WSDL to consume this API.

Thanks

Ankita

dchiesa1
Staff

Hi Ankita,

This is a new question and I am glad to answer it. Please post it as a new question.

6907-ask-a-question.png

ankita10j
Participant II
Version history
Last update:
‎05-19-2016 08:27 PM
Updated by: