BizTalk Server 2013: New Adapters Series: WCF-WebHttp

The support for REST has been anticipated for a long time by BizTalk developers. A majority of the services in the cloud these days is REST based. When exposing a public API over the internet to handle CRUD operations on data REST has now generally been considered the best option. Twitter, Google, Salesforce, eBay, Amazon all offer REST API's to use their services. Not only these, but many more companies support REST or will support it as the number of mobile devices and light weight rich (Ajax) web applications will increase significantly coming years.

In previous posts on the new adapters available with BizTalk Server 2013 I discussed both the Relay adapters: BasicHttp, NetTcpRelay and the Service Bus SB-Messaging. In this post I like to discuss the WCF-WebHttp adapter in his current state in the BizTalk Server 2013 Beta. The adapter offers the capability to send messages and to receive messages from a RESTful Service endpoints.
Note: Since BizTalk sends out message bodies you will need to configure the adapter to prevent this for the GET and DELETE request . This configuration currently is not available yet and the current option (with BizTalk Server 2013 Beta) is to remove the message body with a pipeline.

Below you find a diagram of a scenario I like to walk-through, where I consume a RESTFul Service endpoint of the US Federal Aviation Administration. From a client application I will send a request for the status of an airport, which will by BizTalk to the Restful service endpoint.This endpoint will provide the status of a given airport based upon the airport code I provide within the request URL. The result will be routed back to the client application.image

The GET request is the fundamental, widely used operation in REST world. You can simply visit a URL in a browser (or programmatically); for instance in this case for instance the following URL and the browser returns a machine understandable structured data like below:


To get this done through BizTalk you need to configure a send port with the WCF-WebHttp adapter. The following picture shows the WCF-WebHttp REST adapter configuration. In the general tab the address URL, the HTTP Method and URL mapping are specified.


In the address the URI for the REST interface where the message is sent is specified. The HTTP method to URL mapping can be specified as a singular format or a multi-mapping format. In this sample it is multi-mapping format. The Variable mapping is specified by click the Edit… button.


Variable mapping is a technique that enables you to parameterize your request to a RESTful endpoint. Hard coding the airport code is not a viable option. The other tabs provide you ability to configure the time-out and encoding-related properties, define the security capabilities of the WCF-WebHttp send port, configure the endpoint behavior for the send port and configure the proxy setting for the WCF-WebHttp send port. For this sample all these are left untouched (default).

When I start the client I can select an airport in the US and request the status.


The request will be sent to an WsHttp endpoint in BizTalk Server. This endpoint is created through BizTalk WCF Publsihing Wizard exposing the following schema.


The request will be routed to the send port with WCF-WebHttp adapter, which will sent the request i.e. request resources through the GET method based on the following:

The result is mapped back to response message of the WsHttp endpoint and returned to client for rendering the UI. You can download this solution from the Code Gallery.

Other resources related to the WCF-WebHttp worth to check out are:
In the next post I will discuss the SFTP adapter.




Unknown said…
Great Article! Can you please provide the Source Code for this Demo.

The source code can be found at the MSDN code gallery. The URL is
Unknown said…
I referred your article to configure wcf-webhttp adapter but still not able to connect with given API.

Actual URL:

my wcf-webhttp configurations are:
Address URI (https://ServerName/1.0/)

HTTP Method and URL Mapping with

But Request ended with below exception.

Error Message:

The adapter failed to transmit message going to send port "SndRestAx" with URL "https://ServerName/1.0/". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.Net.WebException: There was no endpoint listening at https://ServerName/1.0/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

I can access this using C# Code. Can you please advice what is missing in this configuration?
Matt said…
Where can I get the AirportService.svc that is referenced Demo.Solution.Client project in the Services folder?
You can use the BizTalk WCF Service Publishing Wizard to expose the request/reponse schema's (i.e. RaceResult.xsd) as WCF Service, choose basicHttp binding for simplicity and BizTalk application (i.e. receive location).

Popular posts from this blog

DTAP Strategy: Pricing and Licensing

Table Operation on Oracle 11g XE with OracleDbBinding

Integration, the community blasting into 2017!