Wednesday, November 9, 2016

BizTalk integration acting as a proxy to REST API for dummies

Overview

These instructions provide easy to follow steps to create a simple BizTalk integration acting as a proxy to a backend REST API.

Instructions


Create a new project.



Add new property schema item to the project.





Rename 'Property1' to 'search_term' in the 'PropertySchema1.xsd'.






At this point it's probably a good idea to give the application name and set signing.

Go to the project properties.



Go to Deployment -> set Application Name value













Go to Signing and in the key file selection select <New...>



Give a name for the key






Build the solution.











Deploy the integration to BizTalk.















Go to the BizTalk Server Administrator Console. Your newly deployed integration should be there.



Next we'll create receive location and receive port.
Go back to the Visual Studio and go to Tools -> BizTalk WCF Service Publishing Wizard.






Select WCF-WebHttp and DeploymentFrameworkTest application.


















Request-Response Receive Port is needed for our proxy integration because it needs talk back to the caller.



Give a name for the IIS app. Allow anonymous access. You can change this later in IIS if needed.



Create.


Fi



Go to IIS Manager, you'll see the app was created.




Go to the BizTalk Server Admin Console.
A receive location and a receive port were created.















Go to the receive location -> Configure.
BizTalkServerIsolatedHost as receive handler basically means this happens outside the BizTalk, namely IIS in this case. Because we creating a proxy that does not in any way do modifications to the data, pipelines are both PassThru.



To the HTTP Method and URL Mapping insert the following code:

<BtsHttpUrlMapping>
<Operation Method="GET" Url="/{search_term}"/>
</BtsHttpUrlMapping>

Then click 'Edit'.



The value for the property namespace can be fetched from the Visual Studio project.






On the messages tab add 'GET'.




















OK



OK



Go to the send ports and create a new port.



Set whatever name you want and click Configure.

















Set the URI. In the mapping insert the following (replace [your profile] and [your own API key] with you own values you have got from the service):

<BtsHttpUrlMapping>
<Operation Method="GET" Url="/basic?search_word={search_term}&amp;profile=[your profile]&amp;key=[your own API key]&amp;country=se&amp;version=1.1.3"/>
</BtsHttpUrlMapping>



The mapping values are the same as in the receive location.



OK



In Filters set property BTS.ReceivePortName == WcfService_DeploymentFrameworkTest/Service1
OK



Set retry count to 0



OK



Start the application






If you want to see possible error messages edit the "C:\inetpub\wwwroot\DeploymentFrameworkTest\Web.config".

Set includeExceptionDetailInFaults="true", httpGetEnabled="true", httpsGetEnabled="true" and save the file.









Now you can call the integration that proxies the request to the backend REST API and returns the response.













No comments:

Post a Comment