In this article, I will show you how to connect to on-premise hosted HTTP endpoints (which now has public access) from Logic Apps. We will do this by using the Logic Apps on-premise data gateway and Logic Apps custom connector. This feature is recently available by the Logic Apps product team. For the people who had never used on-premise data gateway before, please read my previous blog post “Installing and Configuring on-premise data gateway for Logic Apps” which contains a detailed explanation of the Logic App on-premise data gateway.
Part 1: Deploying a webservice on a local machine
You are already familiar with this part:
- I am doing this in the most classical way. Empty template, no authentication and add>new item>Web Service (ASMX). You can do it in your preferred way REST, MVC Web API or WCF Webservice etc.
- Write some web method. Again, I am doing it in easiest way so, for example "HelloWorld" with one parameter:
- Build the web application and deploy it to local IIS.
- Browse the website and save the full WSDL. You will need this WSDL file in part 2.
Part 2: Creating a custom connector for the webservice
- Log on to your azure subscription where you have on-premise data gateway registered. Create a resource of type “Logic Apps Custom Connector”.
- Open a custom connector and click on edit. Choose API Endpoint as SOAP and Call mode as SOAP to REST and then browse to upload WSDL file of your on-premise webservice.
Please note that if you are trying to access an REST/Swagger/OpenAPI web service, you will need to choose REST as API endpoint.
- Again, click on continue as no authentication for this demo
- In the definition tab, fill some summary and description. Keep default value of rest of the configuration and click on “Update connecter” from top right of the screen.
- The custom connector is ready to use now.
Part 3: Integrating with an on-premise webservice from Logic Apps
- Create a new Logic App. Start with Recurrence trigger.
- Add an action and search for your custom connector:
- Choose your web method as action. Then choose your on-premise gateway which you want to use to connect with your on-premise web service and click on create
- Enter the value for your name parameter and with that your final logic app should look like the following:
- Click on save and then run it. Within a moment you should see response from your on-premise web service based on your input parameter
Thanks for reading! I hope you've found this article useful. If you have any questions around this or looking for additional information, feel free to comment below.
Want to discover more? Check out these sites:
- Logic App on-premise data gateway: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-gateway-install
- Logic App custom connectors: https://docs.microsoft.com/en-in/connectors/custom-connectors/