BizTalk and Rest Example from BizTalk Saturday

Posted: February 11, 2013  |  Categories: BizTalk Uncategorized

This is one of my demonstrations from BizTalk Saturday at Auckland on 9/02/2013. This event was organised by Bill Chestnut and Nikolai Blackie.

BizTalk 2013 Hands On Day - 03 REST

I was asked if you could use the same ReST send adapter and dynamically send different ReSTful requests. For example can we use a send adapter to send two GETS that use the  base URI of i.e

As it happens I had a demonstration that showed one way of doing this. This demo sends a request to ReSTful service to get a list of Broadband demand points and then the details each Broadband demand point is subsequently retrieved from another ReSTful service that has the same base url.  I configured a send port as shown below that had two different operations for the two ReSTful requests.


<Operation Name=”GetDemandCategory” Method=”GET” Url=”DemandCategory/{id}”/>

<Operation Name=”GetDemandPoint” Method=”GET” Url=”DemandPoint/{id}”/>



The variable mapping was configured to use id context property with a name space of https://Datacom.BT.RestDEmo.ExternalSchemas.Broadbandmap_Govt_NZPropertySchema. The two schemas that reference this property schema for GetDemandCategory and GetDemandPoint are respectively.


The send pipeline is configured to use the Saravana Kumar’s RemoveBody custom pipeline and the receive pipeline uses a custom pipeline.  The custom receive pipeline  adds a namespace to the response from the ReST service and stamps the message with a BTS.Operation = GetDemaondPoint.


The send adapter subscribes to messages from the message box using these filters. The first filter subscribes to the initial request to get the Demand Point list and the second filter subscribes to the DemandPoints that are split from the  list response..



A receive port and receive location was created to with a file adapter to initiate the ReST request. The receive pipeline dissembles the message as XML and then promotes BTS.Operation = GetDemandCategory.



<ns0:Broadbandmap_Govt_NZ xmlns:ns0=”http://Datacom.BT.RestDEmo.ExternalSchemas.Broadbandmap_Govt_NZ”>

If the message above is submitted to the receive location , then it is submitted to the message box,  the BroadbandMap.Govt.NZ send port subscribes to the message and  a request like “GET HTTP/1.1” is sent. The response is

<?xml version=”1.0″ encoding=”UTF-8″?>
<DemandCategory href=””>
<Title>Professional, Scientific and Technical Services</Title>
<ImportedTitle>Professional, Scientific and Technical Services</ImportedTitle>
<Parent linktype=”has_one” href=”” id=”4″></Parent>
<Points linktype=”has_many” href=””>
<DemandPoint href=”” id=”3938″></DemandPoint>
<DemandPoint href=”” id=”3943″></DemandPoint>
<DemandPoint href=”” id=”3944″></DemandPoint>
<DemandPoint href=”” id=”3954″></DemandPoint>
<DemandPoint href=”” id=”3957″></DemandPoint>
<DemandPoint href=”” id=”3959″></DemandPoint>
<DemandPoint href=”” id=”3960″></DemandPoint>
<DemandPoint href=”” id=”3965″></DemandPoint>
<DemandPoint href=”” id=”3967″></DemandPoint>
<DemandPoint href=”” id=”33207″></DemandPoint>
<DemandPoint href=”” id=”33208″></DemandPoint>
<DemandPoint href=”” id=”6950″></DemandPoint>
<DemandPoint href=”” id=”6954″></DemandPoint>
<DemandPoint href=”” id=”6959″></DemandPoint>
<DemandPoint href=”” id=”6961″></DemandPoint>
<DemandPoint href=”” id=”6962″></DemandPoint>
<DemandPoint href=”” id=”6963″></DemandPoint>
<DemandPoint href=”” id=”6966″></DemandPoint>
<DemandPoint href=”” id=”6970″></DemandPoint>
<DemandPoint href=”” id=”6977″></DemandPoint>
<DemandPoint href=”” id=”7961″></DemandPoint>
<DemandPoint href=”” id=”9944″></DemandPoint>
<DemandPoint href=”” id=”9948″></DemandPoint>
<DemandPoint href=”” id=”9950″></DemandPoint>
<DemandPoint href=”” id=”9953″></DemandPoint>
<DemandPoint href=”” id=”9954″></DemandPoint>
<DemandPoint href=”” id=”9958″></DemandPoint>
<DemandPoint href=”” id=”9962″></DemandPoint>
<DemandPoint href=”” id=”9963″></DemandPoint>
<DemandPoint href=”” id=”9964″></DemandPoint>
<DemandPoint href=”” id=”9966″></DemandPoint>
<DemandPoint href=”” id=”9968″></DemandPoint>
<DemandPoint href=”” id=”9970″></DemandPoint>
<DemandPoint href=”” id=”9976″></DemandPoint>
<DemandPoint href=”” id=”9984″></DemandPoint>
<DemandPoint href=”” id=”10966″></DemandPoint>
<DemandPoint href=”” id=”11256″></DemandPoint>
<DemandPoint href=”” id=”11271″></DemandPoint>
<DemandPoint href=”” id=”11268″></DemandPoint>
<DemandPoint href=”” id=”11267″></DemandPoint>
<DemandPoint href=”” id=”11264″></DemandPoint>
<DemandPoint href=”” id=”11263″></DemandPoint>
<DemandPoint href=”” id=”11331″></DemandPoint>
<DemandPoint href=”” id=”11329″></DemandPoint>
<DemandPoint href=”” id=”12490″></DemandPoint>
<DemandPoint href=”” id=”12520″></DemandPoint>
<DemandPoint href=”” id=”34294″></DemandPoint>
<DemandPoint href=”” id=”34293″></DemandPoint>
<DemandPoint href=”” id=”34285″></DemandPoint>
<DemandPoint href=”” id=”34282″></DemandPoint>
<DemandPoint href=”” id=”34278″></DemandPoint>
<DemandPoint href=”” id=”34277″></DemandPoint>
<DemandPoint href=”” id=”34265″></DemandPoint>
<DemandPoint href=”” id=”34126″></DemandPoint>
<DemandPoint href=”” id=”34213″></DemandPoint>

if you temporarily change the receive pipeline on the BroadbandMap.Govt.NZ send port to an XML receive pipeline and create a file send port with a subscription BTS.messageType = DemandCategory then this message will be written to this file location.

if the receive pipeline on the BroadbandMap.Govt.NZ send port is Rcv_broadMap_govt_NZ_DemandPoint the message is stamped with a namespace of http://Datacom.BT.RestDEmo.ExternalSchemas.BroadbandMap_Govt_NZ_DemandCategory , de-batched into individual DemandPoint messages (shown below) and then stamped with BTS.Operation = DemandPoint . The message of type http://Datacom.BT.RestDEmo.ExternalSchemas.BroadbandMap_Govt_NZ_DemandCategory#DemandCategory is an envelope with a body xpath of =”/*[local-name()=’DemandCategory’ and namespace-uri()=’http://Datacom.BT.RestDEmo.ExternalSchemas.BroadbandMap_Govt_NZ_DemandCategory’]/*[local-name()=’Points’ and namespace-uri()=’http://Datacom.BT.RestDEmo.ExternalSchemas.BroadbandMap_Govt_NZ_DemandCategory’]” .

<DemandPoint href=”” id=”34265″ xmlns=”http://Datacom.BT.RestDEmo.ExternalSchemas.BroadbandMap_Govt_NZ_DemandCategory”></DemandPoint>

These messages are once again submitted to the message box. The BroadbandMap.Govt.NZ send port once again subscribes to these messages using the second filter and ReST request like “GET HTTP/1.1”. The responses contain the individual Demand Point details. The BroadbandMap.Govt.NZ.GetDemandPointResponse_FILE send port with a fliter of  BTS.MessageType == http://Datacom.BT.RestDEmo.ExternalSchemas.BroadbandMap_Govt_NZ_DemandCategory#DemandPoint  And Datacom.BT.RestDEmo.ExternalSchemas.DPID Exists writes these message to the file system e.g.

<?xml version=”1.0″ encoding=”UTF-8″?>
<DemandPoint href=””>
<OrganisationTitle>The Techno Geek</OrganisationTitle>
<Street>Sholson St</Street>
<Point x=”175.786527″ y=”-38.0549402″ srid=”” /><ExternalIdentifier></ExternalIdentifier>
<Category linktype=”has_one” href=”” id=”14″></Category>


The source code  and installation package for this example can be downloaded from REST  . You must be using BizTalk 2013 beta, have Saravana Kumar’s RemoveBody custom pipeline installed and have the ESB toolkit installed.


Back to Top