BizTalk Server - Consuming RESTful Service using WCF-WebHttp Adapter (Part 1)

Introduction

The WCF-WebHttp adapter provides the Support for Restful services in BizTalk. The WCF-WebHttp send adapter sends HTTP messages to RESTful services and receives messages through an exposed endpoint. For GET and DELETE request, the adapter does not use any content/payload. This article will describe how to consume a RESTful service using WCF-WebHttp.

Configure WCF-WebHttp Adapter to Call GET

Create a receive port that will receive XML file and bind this port to send port using receive port name filter property. The receive port will be used to trigger the send port. The orchestration or any other method can be used to trigger this send port.

Below is the send port configuration of WCF-WebHttp adapter to call Get method of rest service.


In this case, we have a static IP, we can also be configured like this:

Configure WCF-WebHttp to Call GET with Dynamic/variable IP

Calling Restful service with Dynamic/variable IP address HTTP GET method.

Create a receive port that will receive XML file and bind this port to send port using receive port name filter property. The order file will be received from the receive port and the field Id will be promoted as Order schema has promoted property Id. We’ll use this promoted field Id in URL Mapping on the send port.


Below is the send port configuration of WCF-WebHttp adapter to call Get method of rest service with a variable in URL. Below is the URL mapping.

<BtsHttpUrlMapping>

**    <Operation Method="GET" Url="api/v1/book/{id}" />**

</BtsHttpUrlMapping>

Variable Mapping

In URL, {id} is the variable and its value will be mapped from promoted field Id. To map the variable, go to Variable Mapping section, click Edit and then add variable mapping as shown below.



Finally, create another send port add filter property to above-configured port. This port will get the response and send it to a specified location.


In this article, we have described a simple scenario of consuming GET method of RESTful service.