다음을 통해 공유


Logic Apps: Make your HTTP endpoints SOAP enabled

Abstract

This article will make http endpoints or Logic Apps as SOAP enabled so that legacy applications can be untouched and work seamlessly using their old contracts (WSDL).

Introduction

We are going to need:

  1. A simple Logic Apps which processes our request and send XML data
  2. WSDL file – Contract file.
  3. Create API in “Azure API management Service” – In here, we are going to create a WSDL based API wrapper for our Logic Apps or an http service.
  4. Postman/SOAP UI- http/SOAP tools which ensures our http service that supports SOAP based web service.

A simple Logic App

My simple Logic App, which processes XMLs, would like below.

Graphical View

 

Code View



      {  
                 "definition": {      
                 "$schema": "              https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json            #",      
                 "actions": {      
                  "Response": {      
                  "inputs": {      
                   "body": "<      details      >\n<      message      >you have entered</      message      >\n<      value      > @{json(xml(triggerBody()))['soapenv:Envelope']['soapenv:Body']['tem:GetData']['tem:value']}</      value      >\n</      details      >\n",      
                   "headers": {      
                   "content-type": "text/xml"      
                   },      
                   "statusCode": 200      
                  },      
                  "kind": "Http",      
                  "runAfter": {},      
                  "type": "Response"      
                  }      
                 },      
                 "contentVersion": "1.0.0.0",      
                 "outputs": {},      
                 "parameters": {},      
                 "triggers": {      
                  "manual": {      
                  "inputs": {      
                   "schema": {}      
                  },      
                  "kind": "Http",      
                  "type": "Request"      
                  }      
                 }      
                 }      
      }  

Usage

WSDL File

WSDL file contains “GetData” method and in Soap UI.

 

Create API in “Azure API management Service”

Choose the WSDL option from the below template.

Fill the below form to create API.

 

Here is my GetData API created and version enabled.

There are four parts in it.

  1.  Frontend
  2. Inbound Processing
  3. Backend
  4. Outbound processing

Frontend

Inbound Processing

Note that we are setting up (blue shaded in the below Logic App Uri) “/manual/paths/invoke” and four query params (red highlighted).  

Logic App URL:

https://prod-05.southindia.logic.azure.com:443/workflows/****26274cff5404ead625930********/triggers/manual/paths/invoke

?api-version=2016-10-01

&sp=%2Ftriggers%2Fmanual%2Frun

&sv=1.0

&sig=URPdn_zXixuuzAZymv1FOPkxTTKrqBJxsD6jE376cp8

 

 

nb

 

Backend

This is the place where you define whether you are going to call some other http service or a Logic App endpoint.

Outbound Processing

 



      <    policies    >  
                 <      inbound      >      
                 <      base />  
                 <      set-backend-service id="apim-generated-policy" backend-id="LogicApp_myOwnLogicAppSample1" />  
                 <      set-header id="apim-generated-policy" name="Ocp-Apim-Subscription-Key" exists-action="delete" />  
                 <      set-query-parameter name="api-version" exists-action="override">  
                  <      value      >2016-06-01</      value      >      
                 </      set-query-parameter      >      
                 <      set-query-parameter name="sp" exists-action="override">  
                  <      value      >/triggers/manual/run</      value      >      
                 </      set-query-parameter      >      
                 <      set-query-parameter name="sv" exists-action="override">  
                  <      value      >1.0</      value      >      
                 </      set-query-parameter      >      
                 <      set-query-parameter name="sig" exists-action="override">  
                  <      value      >{{getdata_5b406e119f3a9206cc35d92a_5b4092e6337309eb36e284f1}}</      value      >      
                 </      set-query-parameter      >      
                 <      rewrite-uri template="/manual/paths/invoke" />  
                 </      inbound      >      
                 <      backend      >      
                 <      base />  
                 </      backend      >      
                 <      outbound      >      
                 <      base />  
                 <      set-header name="content-type" exists-action="override">  
                  <      value      >text/xml</      value      >      
                 </      set-header      >      
                 </      outbound      >      
                 <      on-error      >      
                 <      base />  
                 </      on-error      >      
      </    policies    >  

Execution

Now we should be able to see the http service receiving as per the WSDL we had chosen and expect an output from Logic Apps.

Create a request in postman/Soap UI.

Postman

Create Headers as below

And hit send button, service response as follows,

This below request is working with the WSDL we had uploaded and soapAction has been set by default, we add only “Ocp-Apim-Subscription-Key”.

Conclusion

Most of the time we would succeed modernizing our systems, but for some systems it is not possible due to the cost & time. That time, it is still required to keep our old contracts still valid. One of the case is, exposing SOAP services from Logic Apps so that our existing systems can go untouched and use their SOAP contracts or WSDL.