Currently BizTalk Server 2016 has support for REST, but the support is fairly limited and is missing some feature that most developer expect from REST services.
To overcome these missing feature for companies that are exposing these services to their consumers/partner over the internet, I will show you have to use Azure API Management to publish SOAP services from BizTalk as REST.
For this blog post I took the Hello World example from the BizTalk SDK samples and converted it to a Request/Response orchestration and used the WCF publishing wizard to publish
Publish schema as WCF service (this allows better control over the URL)
Rename the Service and Operation, Select Schemas
Select the location to publish to and I am allowing Anonymous for my example
Note: I ended up using BizTalkWcfService2 as the URL, because an issue I am working with the API Management group
Publish Service
Now you need to setup the App Pool and make sure you can get the WDSL, for this example, We also need to update the WSDL to have the internet name for the server, by default the WSDL is going to be generated with the local server name
I downloaded the WSDL file and changed the server name
Open your Azure API Management Instance and go to the Add a new API blade
Click Upload to upload the WSDL file, if it was not necessary to change the WSDL file you could use the URL instead
Update the highlighted fields with your values, Click “Create”
Wait for the create to complete, Click “Done”
Now before we can use our newly imported SOAP service exposed as REST, we need to add it to a Product to allow users to call it.
I am using a Product Named BizTalk, you can create and use any Product Name you like
Now I go back to the API Definition, Click on our “submit” operation
Then Click on the “Test” Tab
This is the Test blade, notice that API Management has supplied the API Management Subscription Key (necessary to call API Management, this is based on the product we put our API in), the Sample JSON Document and a “Send” button to test with. Click the “Send” button
View the results of the call
You will notice that the send and receive bodies are JSON, but we are calling a SOAP Service, this is what the SOAP call would look like
Lets now examine how API Management published our SOAP Service as REST, on the API tab, Click the “View Code”
The API Management use a policy to do the inbound and outbound transformation, the policy uses the liquid language to do the translation from JSON to XML and them XML to JSON and include error handling
The process of importing our WSDL as REST to SOAP automatically created the policy that does the transformations and also created the inbound and outbound JSON schemas
In a later blog post I will talk about how you can modify the schemas and the transformation.
One of the main features that BizTalk is missing with its REST adapter is the ability to provide the definition of the API for the clients to use to generate the code to call our REST services, in the Developer Portal, API Management provides either Open API (swagger) or WADL for our clients to use.
I hope this blog post helped you understand how you can use Azure API Management to publish your BizTalk SOAP Services as REST
Comments