POST method at Receive Port

POST Method does not send data in URL Parameters as GET Method sends. In Post method, Rest Service sends data in Message body. Mostly this is in json format. When BizTalk Receive this file, then through the use of JSON decoder pipeline component, BizTalk convert the json into xml format.

For Pipeline configuration related information, you can refer to below reference:

At BizTalk Receive port we just adding a   below details in HTTP Method and URL mapping in Wcf-WebHttp adopter configuration.

<BtsHttpUrlMapping><Operation Name=”<Name>” Method=”POST” Url=’/OperationName/Request’ /></BtsHttpUrlMapping>


Here no need to do anything with Variable mapping. Apply “Content-Type:application/json” to process data as JSON.


Note: For Get Operation we have to keep GET verb in Incoming Message, for Post operations keep blank only.

POST Method at Send Port:

In case of when BizTalk consuming Rest Service through its Send Port with Wcf-WebHttp adopter, then its configuration is same as in Receive Port except one nominal change in below configuration.

<BtsHttpUrlMapping><Operation Name=”” Method=”<REST METHOD>” Url=’/OperationName/Request’ /></BtsHttpUrlMapping> 

There is not require to provide Operation name, we can leave it blank as above.


GET method at Receive Port

When we publish BizTalk as REST Service, then it’s not directly linked with Schema or Orchestration like WCF or Web Service does. in my previous blog, I have mentioned how to publish BizTalk as REST Service with help of BizTalk WCF Service Publishing Wizard Tool.

Here when we define the action configuration in Receive Location in that we provide Message Context property BTS.Operation for Operation Name, through this message context property, incoming message can link with orchestration Receive Port or Send Port with applying details in Filter. In below example

<BtsHttpUrlMapping><Operation Name=”TESTGETMETHOD” Method=”GET” Url=’/OperationName/Request?Param1={param1}&amp;Param2={param2}’ /></BtsHttpUrlMapping>

Here Operation name is TESTGETMETHOD. So BTS.Operation Message Context Property is stand for TESTGETMETHOD.

For Pipeline configuration related information, you can refer to below reference: 

The purpose of enabling GET operation is to fetch data from target system. Other perspective is when request parameters are few in count wise, then we can go with GET API URL.

We will discuss the configuration details at receive location transport level for GET operation.

  • Promote the elements (Param1 and Param2) from message schema whose elements are going to use in GET API URL.
  • Navigate transportation configuration of the REST API receive location and add below text in HTTP method and URL mapping shown in below snap.
  • <BtsHttpUrlMapping><Operation Name=”<Name>” Method=”GET” Url=’/OperationName/Request?Param1={param1}&amp;Param2={param2}’ /></BtsHttpUrlMapping>
  • If there is not require any parameter in GET method then no need to add parameters in BizTalk Schema.
  • Rest11.jpg
  • Map the elements with property schema element names and namespace as below.


In GEt method of REST Service, there is no message body. Information is sending in URL as Parameter as in below example:


here Param1 and Param2 are the two parameters of the GET method. Now We need to understand how BizTalk work with this. In above screen shot we are defining Variable Mapping. In variable Mapping, we are assigning parameters with Property Schema. We need to define Property Schema variable with Message Context Property. Otherwise it will not assign any value.


Create your property schema with those properties, set the Property Schema Base to MessageContextPropertyBase.

When BizTalk receive request with JSON decoder pipeline, then its create message.

Receive location transportation url would be like this: /BizTalkRestServiceTest/Service1.svc

Note: Get Method does not contain any message it has just URL. So, You need to create custom message body in Receive pipeline Disassembler stage. You can download code from github from below reference.

GET Method at Send Port:

In case of when BizTalk consuming Rest Service through its Send Port with Wcf-WebHttp adopter, then its configuration is same as in Receive Port except one nominal change in below configuration.

<BtsHttpUrlMapping><Operation Name=”” Method=”<REST METHOD>” Url=’/OperationName/Request’ /></BtsHttpUrlMapping> 

There is not require to provide Operation name, we can leave it blank as above.

Publish BizTalk as REST Service

One of the features in BizTalk 2013 R2 is to integrate REST API with other systems/entities. As data process via JSON format we use JSON relevant pipelines to have syntax transformation (JSON to XML and vice versa).  In this article, we will share how to expose REST service in BizTalk and configure it at receive and send port level.

For more about json pipeline, you can refer to my previous blog BizTalk with Rest Service.

We can categorize aforementioned process into below steps.

Step1: Expose REST API in BizTalk and apply in Receive stage.

Step2: Apply GET method at Receive Port

Step3: Apply POST method at Receive Port

Step4: How to test from Postman UI


Configure REST API using BizTalk WCF Service Publishing Wizard so that it creates service in IIS and Receive location in admin console.

  • Open BizTalk WCF Service Publishing Wizard Tool and click on Next button in Home page and below screen populates.
  • Select WCF-WebHttp adapter and enable second check box and select respective BizTalk application name and click on Next.


Click Next in below screen


Select Receive Port Type as per Business requirement as below screen


Provide relevant name in URL for the service as below screen


Click Next


Now you can see the XSLD has ready to generate for this Rest Service. Click on Create> and finish the process.


Now the BizTalk WCF Service Publishing Wizard work is done. Next is just configuration change require on IIS and Receive Port.

Open IIS manager and select the BiztalkRestServiceTest Service and set up the Advance Settings


Start the Newly Created Receive Location in BizTalk Admin Console, then browse the Service from IIS. By default, its URL is created with Service1.svc.


Ensure that below settings available in web.config file.


WCF Service in IIS and BizTalk Receive location is created so far.

In below reference, its defined to convert .svc url into REST API url.

Convert .svc URL to Rest API URL

We can change the URL as defined above. It’s not recommended but good to look that BizTalk publish as REST Service then its URL also look like as REST Service.

Step2:  Apply GET method at receive port.

Receive Port Configuration is provided in next blog as below:

Step3: Apply POST Method at Receive Post:

Receive Port Configuration is provided in next blog as below:



Convert svc URL to REST API URL

When we publish BizTalk as REST Service, then it’s generate as below by default.


when we apply REST verb with this URL, then it’s become as below for Business User.

For GET Method:


For POST Method:


We can change the Service1 name with some other name but can’t change the .svc.

So, for outer world (Consumer), it’s look like they are consuming the WCF Service instead of REST Service.

So, making feel like as REST Service we need to do some small thing as below:

  • Install Microsoft Rewrite URL module 2.0 (it’s freeware) for IIS to accept the rewrite tags in service configuration files.

  • Add below rewrite module entries in service web.config file to enable us to use api name in service URL.




<rule name=”TestService1”>

<match url=”/Service1(.*)” />

<action type=”Rewrite” url=”Service1.svc/{R:0}” />


<add input=”{REQUEST_METHOD}” pattern=”GET” />



                     <rule name=”TestService2”>

<match url=”/Service2(.*)” />

<action type=”Rewrite” url=”Service2.svc/{R:0}” />


<add input=”{REQUEST_METHOD}” pattern=”POST” />





  • URL will refer as below instead of Service1.svc at postfix.

GET Method:


For POST Method:


Implementation of BAM Activity Definition file

When we install BAM in BizTalk Server then its add BAM (Business Activity Monitoring) in Add-Ins in Microsoft Excel File. For implementation of BAM or create Activity Definition file of BAM we need to follow the following process.

Open Excel File -> File -> Options -> Add-Ins


Click on Go… Button as in above screenshot. Now below popup will open, Select the Business Activity Monitoring and click OK.


Now click on Add-Ins Tab in Excel file as below screenshot. And select BAM Activity. as defined below.


Now Activity Definition file will open as below:


Here we need to define the data and milestone, which will need to capture from the BizTalk applications when message process.

Here I have defined some data as below screenshot:


Item type as Business Milestone is related to Date Time.




After defining Activity data, we can also define these things in BAM View as below to look more familiar to Business Users.





Now if require then we can go for below feature otherwise we can escape this.



Click next and finish the Activity Creation.

After finishing the creation of Activity details, we need to export then details in xml format as defined below:


BAM Definition file will look like as below:


Now we need to execute the below command to setup the activity Details in BAMPrimaryImport Database.

bm.exe deploy-all -DefinitionFile:<def file>[ -Server:<server> ][ -Database:<database> ]


The BAM management utility deployment commands allow you to apply, modify, and remove definitions.

  • exe deploy-all: Deploys a BAM definition.
  • exe update-all: Updates a BAM definition.
  • exe remove-all: Removes a BAM definition.

BAM Portal:

Now you can check this on BAM Portal. If you run BAM Portal first time then need to set the Compatibility View Setting on Internet Explorer. If you want to open BAM Portal on Google Crome then you need to add IE Tab in Crome.

For more information about how to open BAM in different browser, you can refer below reference:


For more information about BAM, please refer the below reference:





BizTalk with REST Service

Now in BizTalk 2013 R2 release, Microsoft provide the communication with Rest Services through WCF-WebHttp adapter. Here are below things added in BizTalk to consume and publish REST Service through BizTalk.

  1. WCF-WebHttp adapter- to communicate with REST Service
  2. JSON decoder pipeline component- to convert Json file into xml format in Receive Pipeline.
  3. JSON encoder pipeline component- to convert xml file to Json in Send Pipeline.
  4. JSON Schema Wizard- To generate xsd from json file.

as we know RESTService has always prefer to have data in json format.

Note: Sometime when RESTService respond with empty message then BizTalk will generate the Object Reference is not found error in JSON decoder pipeline. Micorsoft has release the hotfix for that. You can download from below site.


Before BizTalk 2013 and upper version release, BizTalk was not communicating with REST Services without adding custom coding at pipeline level.

For older Version of BizTalk to communicate with REST Service you can refer the below reference:


Following five HTTP methods are commonly used in REST based architecture.

  • GET – Provides a read only access to a resource.
  • PUT – Used to create a new resource.
  • DELETE – Used to remove a resource.
  • POST – Used to update existing resource or create a new resource.
  • OPTIONS – Used to get the supported operations on a resource.

Generate an XSD schema for JSON message

You can Refer to below link:

Create pipelines to process JSON messages

Receive Pipeline:

We are using JSON decoder pipeline component in Receive Pipeline to convert json to xml format. This pipeline has two properties (if you have installed above define hotfix then three properties)

As mentioned in below screenshot.


Below property details should be defined.

Add Message Body For Empty message: By default its False, we need to make this true to handle empty message. (This property only available when you have installed above defined hotfix).

Root Node: Define the schema root node name of the schema which is created through JSON Schema Wizard

Root Node Namespace: define the namespace of the schema which is created through JSON Schema Wizard.

Send Pipeline:

For sending json file from BizTalk, we can use the JSON encoder pipeline component. This component converts xml to json file. There is only one property in this pipeline component as defined in below screenshot.


Remove Outer Envelope: By default, this property is defined False. When we make it true then its remove top layer or envelope of json file.


Json file with property Remove Outer Envelope as False:


  “TestRequest”: {

    “Test”: {

      “TestRequire”: true




Json file with property Remove Outer Envelope as True:


  “Test”: {

    ” TestRequire “: true



For more info you can refer to below reference:

These are the prerequisites knowledge about how to deal with Rest-service through BizTalk.

Now in next blog we have defined that how to publish BizTalk as REST Service.


Terminating Instances running on Isolated Host

Most of the cases when we are trying to terminate the running or suspended instances from BizTalk admin console, then we directly terminate them from the admin console. If it’s not terminate in first trial then we need to follow the below process:

1st Approach: Re-start Host Instances

Terminate the instance and re-run the Run Query. If it’s not terminated then we can restart the respective host instances and in case of isolated host, restart the IIS, then check. if is again not terminated then we need to go for below approach.

Note: Below approach should not be tried in production server, if it’s require then firstly take the backup of data then proceed further.

2nd Approach: Remove from Database

Database: BizTalkMsgBoxDb

SQL Statement For termination of running or suspended Instance



exec dbo.int_AdminTerminateInstance_<Host Instance Name> @uidInstanceID, @uidServiceID, @out


Here @uidInstanceID = uidInstanceID and @uidServiceID = uidServiceID of Instances Table.

Before executing the termination query, we need to understand following info.

Instances Table: This table has all the running and suspend instance details


Here uidAppOwnerID column name represent the Host Instance GUID. We can get the host instance name in respect to uidAppOwnerID from Applications Table.

Application Table:


So now we know the instance details and Host Instance information.

In BizTalkMsgBoxDb database, for every host instance there is dedicated stored procedure for terminating the instance.


Host Instance Stored Procedure for Termination
BizTalkServerApplication dbo.int_AdminTerminateInstance_BizTalkServerApplication


BizTalkServerIsolatedHost int_AdminSuspendInstance_BizTalkServerIsolatedHost

So, for termination the instance, we get the Host Instance Name from BizTalk Admin Console. We get the uidAppOwnerID as uidAppID information from Applications table for Host and message info (Instance ID and Service ID) from Instances table.

Now we run the sql statement to terminate the instance. Here we are terminating the instance of BizTalkServerApplication host instance.




exec dbo.int_AdminTerminateInstance_BizTalkServerApplication ‘4844E88F-F3A9-4057-B252-1D09834B02E2’, ‘0C474F97-45FC-49FA-9D86-D3413804D056’, @out


Check the Instance Table that the Instance has deleted or not.