In this code sample, we will call on-premise WCF Service from Logic Apps through BizTalk Server 2016. Here, WCF Service is responsible for getting account details for a specific Sunny Electricals customer. We will use Consume WCF Service Wizard to generate XSD schemas for the WCF Service and generate an IIS endpoint for Logic App to trigger.
This solution requires the following components to be installed and configured along with Microsoft BizTalk Server 2016:
We have already discussed in Chapter 8, A Deep Dive into Logic Apps, how to install and configure an on-premise data gateway using your Azure subscription. We will use the on-premise data gateway along with BizTalk Server and Logic App Adapter to make the hybrid solution.
We assume that you have already installed and configured an on-premise data gateway on BizTalk Server, if not, you can refer to Chapter 8, A Deep Dive into Logic Apps, for the installation and configuration of on-premise data gateway. Once you are done with the on-premise data gateway, you need to set up and configure the Logic App IIS endpoint correctly to access BizTalk Server environment from logic through an on-premise data gateway.
The step-by-step documentation to configure IIS for Logic App Adapter is as follows:
run
to open up the Run command window. Type inetmgr
in the search box and click on enter.LogicApp
and click on ok to add a new IIS Application Pool.
ManagementEndpoint
, and for the physical path, enter the installation path of Logic App ManagementEndpoint
. The default path will be C:Program Files (x86)Microsoft BizTalk Server 2016LogicApp AdapterManagement
.ManagementEndpoint
, change the IIS Application Pool to Application Pool created earlier.http://localhost/ManagementEndpoint/Schemas?api-version=2016-10-26
. This will give a list of schemas deployed in the BizTalk Server Management database.
We move ahead to create a BizTalk solution, which will call a WCF Service hosted within the corporate network. Create a Visual Studio BizTalk Project and use Add Generated Items | Consume WCF Service to generate XML schema for the WCF Service, which will return customer account details.
Enter the URL of the on-premise-hosted WCF Service to generate the WCF data contract, which will be used within the orchestration.
Create a simple orchestration, which will receive customerId as a request and call the WCF Service to get account customer information. All the logical ports in the orchestration are configured with a specify later binding. The solution containing the schemas and orchestration is signed with a strong name and deployed to the BizTalk runtime:
The configuration of the physical send and receive ports is done after the solution is deployed to the BizTalk Server administration console.
To create web port, import the binding file in the BizTalk solution, which is generated from the Add Generate Item. To create a request-response, receive a location for Logic Apps Create application within IIS for GetCustomerDetails
and set the application poll same as of LogicApp Management Endpoint
. Set the Application path for GetCustomerDetails
to use C:Program Files (x86)Microsoft BizTalk Server 2016LogicApp AdapterReceiveService
.
In the BizTalk Admin console, create a request response port within the GetCustomerDetails
solution, which will run under the Logic App adapter handler. The configuration details are shown in the following image:
Once the Logic App design is completed and saved. Trigger the Logic App through the client application or any testing tool such as Postman.
We have used the Postman tool to make an HTTP post on created Logic App. The Logic App workflow calls to BizTalk endpoints through on-premise data gateway and gets the desired customer record into Logic Apps.