BizTalk Server 2013: New Adapters Series: WCF-WebHttp

Posted: March 1, 2013  |  Categories: BizTalk BizTalk Server 2013 New Adapter Series Uncategorized
Tags:
You can download the entire article as a PDF document.
BizTalk Server 2013: New AdaptersSeries: 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 http://services.faa.gov/airport/status/SEA?format=xml and the browser returns a machine understandable structured data like below:

image

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.

image

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.

image

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.

image

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.

image

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:

 http://services.faa.gov/airport/status/SEA?format=xml

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.

Cheers,

Steef-Jan

You can download the entire article as a PDF document.
BizTalk Server 2013: New AdaptersSeries: WCF-WebHttp
#1 all-in-one platform for Microsoft BizTalk Server management and monitoring
Author: Steef-Jan Wiggers

Steef-Jan Wiggers is all in on Microsoft Azure, Integration, and Data Science. He has over 15 years’ experience in a wide variety of scenarios such as custom .NET solution development, overseeing large enterprise integrations, building web services, managing projects, designing web services, experimenting with data, SQL Server database administration, and consulting. Steef-Jan loves challenges in the Microsoft playing field combining it with his domain knowledge in energy, utility, banking, insurance, healthcare, agriculture, (local) government, bio-sciences, retail, travel, and logistics. He is very active in the community as a blogger, TechNet Wiki author, book author, and global public speaker. For these efforts, Microsoft has recognized him a Microsoft MVP for the past 8 years.

turbo360

Back to Top