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.

  • mbrimble

    From: Johann Cooper [DATACOM]
    Sent: Monday, 11 February 2013 6:14 p.m.
    To: Mark Brimble [DATACOM]
    Subject: RE: BizTalk and ReST

    Hi Mark,

    I have downloaded your sample as well as the S. Kumar sample. I copied his pipeline component and the ones in your 3rd party assemblies folder to the BT 2013 pipeline components folder. When I try to build the Pipelines project in your solution I get an error, even though none of the references appear to be broken.
    Nothing I did appeared to work until I opened the properties for the two Datacom.BT.Common.PipelineComponents dlls and chose the unblock option. After I did that I could build the solution.

    I also ran into trouble with S. Kumar’s Remove body pipeline. When I tried to run an input file through the solution that would call on the BroadbandMap.Govt.NZ send port I got the below error.

    There was a failure executing the send pipeline: “BizTalk.RestAdapter.Demo.Pipelines.RemoveBody, BizTalk.RestAdapter.Demo.Pipelines, Version=, Culture=neutral, PublicKeyToken=98c97ec9324f0fce” Source: “Unknown ” Send Port: “BroadbandMap.Govt.NZ” URI: “” Reason: Could not load file or assembly ‘file:///C:Program Files (x86)Microsoft BizTalk Server 2013Pipeline ComponentsRemoveBody.dll’ or one of its dependencies. The system cannot find the file specified.

    This is strange since the name of the pipeline component assembly is BizTalk.RestAdapter.Demo.PipelineComponents.dll, not RemoveBody.dll. Manually changing the assembly name in S. Kumar’s project to RemoveBody and rebuilding and placing this new file in the pipeline components folder worked around this problem.

    Now I am getting the below error on the BroadbandMap.Govt.NZ send port.

    A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

    It turned out that I had to set the proxy server settings in the send port (this is my on premise VM rather than my cloud VM). Once I did this I successfully got output messages in C:TempBroadbandMap.Govt.NZBroadbandMap.Govt.NZ.GetDemandPointOut.

    Hope this is the feedback you were after. Well done, this is a cool example on using REST endpoints.


  • Pingback: TNWiki Article Spotlight - BizTalk Server: REST Services Error Handling - WikiNinjas - Official Blog of TechNet Wiki - Site Home - TechNet Blogs()

BizTalk Server

Over 500+ customers across
30+ countries depend on BizTalk360

Learn More

Manage and monitor serverless
components effortlessly

Learn More
Business Users

Monitor your Business Activity in iPaaS
or Hybrid integration solutions

Learn More

Back to Top