Azure API Management Feature: SOAP to REST

This is the second post in a multi part series on the features of Azure API Management.

As with the previous post where I demonstrated publishing a SOAP Services with pass-through, this time I am going to demonstrate publishing the same SOAP Service as REST, using the SOAP to REST feature of API Management, I consider this feature very important to APIM, in the past many of my clients have built intermediate services using either BizTalk or .Net.

For this blog post I am going to demonstrate how you publish a BizTalk SOAP service as REST in APIM. With APIM you can publish SOAP services by importing the WSDL (this can be either via the URL or by uploading the WSDL file), In APIM Click the “API” menu item on the left, then Click “WSDL”

Add a new API

Add a new API

In this demonstration I am going to use an uploaded file, this is the WSDL from a BizTalk orchestration exposed as a WCF Request/Response Service, it only has a single operation ‘submit”. I am using an uploaded file because the BizTalk server is hosted in an Azure Virtual Machine and I have changed the URL to reflect the DNS name of the Virtual Machine. I could have also changed the name in APIM after the WSDL was imported.  Select “SOAP to REST” and configure as shown and click “Create”

Create from WSDL

Create from WSDL

Once the WSDL import is complete, we can now see the API and it’s operations, now let click settings to look at the API settings, this is where we can change the URL to the BizTalk Server hosting our SOAP Service. Click the “submit” operation, then click the “policy editor”

Frontend

Frontend

Now look at the policy that does the transformation from REST/JSON to SOAP/XML.

Policy that does the translation

Policy that does the translation

Inbound

Inbound

Inbound

Outbound

Outbound

Outbound

Now lets click the “Test” menu, this is where we can test our API Operation, before we release them to our consumers

Test ,menu

Test menu

APIM fills in all the details to test the API, notice that the payload for the API is JSON, this is because we chose SOAP to REST, SOAP services are XML based, but the above policy we looked at does the conversion from JSON to XML. Click “try it”

Request URL

Request URL

You can now see the results of our call to the BizTalk hosted SOAP Service, the results are in JSON again the policy is doing the conversion, now lets click the “trace” tab, this will give us everything that has taken place in APIM as part of our call to the BizTalk SOAP service.  You can notice that the policy has set the SOAPAction and converted the JSON body to XML

SOAPAction

SOAPAction

The Policy for the SOAP to REST feature is using Liquid Template Language to do the JSON to XML and XML to JSON transforms, these templates can be use to transform from JSON to XML, XML to JSON, XML to XML and JSON to JSON, this allow not only the scenario for SOAP to REST, but the ability to manipulate both inbound and outbound payload for maximum flexibility.

Hopefully this has given you a quick demonstration on how to expose your SOAP Services as REST with APIM.

About the Author:

My name is Bill Chesnut, I am a Cloud Platform & API Evangelist at SixPivot based in Melbourne, AustraliaMy career started in IT in 1983 with the US Defence Departement as an IBM Systems Programmer.
I made the switched to the Microsoft Windows platform in 1994, and has been involved with Windows development ever since.I have worked on numerous enterprise projects using Microsoft C/C++, Visual Basic and SQL Server. Most recently,I have been driving various application integration projects using VB.NET, ASP.NET, XML, XSLT, SQL Server and BizTalk Server to connect a variety of Microsoft Business Solutions applications with other systems.

I am very involved in the Microsoft User Group Community as leader of the Melbourne .Net User Group.

I have also started the Melbourne BizTalk User group.

Reference:

Chesnut, B. (2018). Azure API Management Feature: SOAP to REST. Available at: https://www.biztalkbill.com/2018/08/06/azure-api-management-feature-soap-rest/ [Accessed: 21 February 2019]

Share this on...

Rate this Post:

Share: