Ravindar, Biztalk Developer and Administrator

Just another BizTalk blog

numbers conversion to custom decimal digits in BizTalk

In the MSDN BizTalk forums, one guy has questioned about converting a number/decimal to have predefined decimal points.

means for example if the value is 10.23, he wanted to display it as 10.2300.

one of the MSDN contributer boatseller has given excellent solution.

I’ve learnt this from the post here. the conversion code goes like below

private string formatTo4Dec(string number)
   double dblNumber;
   if (double.TryParse(number, out dblNumber))
      return dblNumber.ToString("F4");
     throw new System.ArgumentException(number + " is not a valid number format.");

similarly for date time custom formats you can have a look here

June 18, 2014 Posted by | Biztalk Server | Leave a comment

BizTalk articles published in Microsoft Technet Monthly Magazine

i feel pretty much happy that two of my BizTalk articles

this and this have been published into monthly magazine by Microsoft Technet.

you can access those two full magazines here and here

June 18, 2014 Posted by | Biztalk Server | Leave a comment

HTTP adapter issues and troubleshoot

I was working to configure HTTP adapter in BizTalk 2010 and faced few issues.

After all struggle i found that the problem was with the .net client code i was using to test, its not problem with BizTalk in any way.

Note: i have learnt that if we try to configure HTTP adapter for 64bit, we need to make sure the apppool should run on .net 4.0 version.

Anyway during the course of this troubleshoot following links have really helped me









http://rohitt-sharma.blogspot.in/2011/03/biztalk-tutorial-part-7-using-two-way.html   (don’t use the .net client code given in this link, it did not work for me)



June 18, 2014 Posted by | Biztalk Server | Leave a comment

Common pipeline that can be used for validation in any BizTalk application

Nabeer has written an excellent article here about a common pipeline that can be used for validation for any schema in biztalk.

Means you can use this pipeline in any BizTalk application for validation purpose, it will validate any schema that is deployed in to biztlk.

I have tested it with multiple scenarios and it works like a charm. If your need is only to use a common pipeline that can validate, then this is a good to use

June 18, 2014 Posted by | Biztalk Server | Leave a comment

Got Silver Medal for “BizTalk Tech Guru” competetion for the month of April

I feel pretty happy and honored for gaining Silver Medal Award for “BizTalk Technical Guru”  for the month of April 2014 conducted by Microsoft. 


you can have a complete list of winners at http://blogs.technet.com/b/wikininjas/archive/2014/05/17/the-microsoft-technet-guru-awards-april-2014.aspx

May 30, 2014 Posted by | Uncategorized | Leave a comment

How and in what cases Property demotion works in BizTalk

Many of us are aware of Property Promotion, but property demotion is less known topic.
MSDN defines property demotion at http://msdn.microsoft.com/en-us/library/aa547894.aspx
as below
“You can use property demotion to copy a property value from the message context into the message content or to its header or trailer”

Property Demotion happens in send pipelines (other than passthru transmit) assmebler stage. Property demotion only happens for the applicable properties in the message context. I will explain them later what they are.

so when a BizTalk send port receives message from message box, it gets message as IBaseMessage with message content(message parts) + message context.

if it is a send pipeline other than pass thru, then
it will receive message as IBaseMessage with message content(message parts) + message context. And few applicable properties are demoted in assembler and after processing all stage this IBaseMessage (which is Message content + message content) is sent to send adapter, and the adapter leaves the message context to garbage collection and sends message content(message parts) to destination.

if it is a pass thru transmit pipeline,
it still receives message as IBaseMessage with message content(message parts) + message context and since there are no components to process, this IBaseMessage (which is Message content + message content) is sent to send adapter, and the adapter leaves the message context to garbage collection and sends message content(message parts) to destination.

We use property demotion in cases for example

you receive an envelop message with some fields in header. You want to debatch it and for every out going message you want to send it with a custom envelop which will have some of the field values extracted from header of the incoming envelop file.

In this case

1. we promote the required fields in Header of incoming envelop

2. promote the required fields in header of the outgoing message in to the same property schema fields created in step 1.

You may get confused for step 2, i will elaborate it later.

That’s it, when you drop the incoming file, properties of the incoming envelope header fields will be promoted and while sending out the debatched message, those properties are demoted from the context into the header section of every outgoing envelop message.

similarly we use property demotion for another case, where we want to use some field values from the header part of the incoming file to the body part fields of every out going message (in first example, we demoted into header section fields of outgoing message, but in this case we want to demote in to body part fields)

as i said i will try to dig in how property demotion happens for applicable fields with 2nd example case.

we shall create 2 xml schemas
1. EmployeeInfo–> that contains employee information
2. Employees–>this is an envelop schema for the EmployeeInfo used for debatching

Create EmployeeInfo schema like below


Create Envelop Schema Employees like below


Now import Employee schema into this envelop schema.

Now set the data structure type of the record EmployeeInfo to ns0:EmployeeInfo like below


Now the employees envelop schema should look like below


If you notice I have created the names of fields in header and in body parts with similar names “companyName” and “city” as it is. I set it so just for simplicity, not mandatory, you can set any name.

Now our agenda is to populate data from header part to some fields in individual outgoing message using property demotion. For this purpose whatever the fields you want to populate values in outgoing message, we have to keep those fields empty in the incoming file. Then the outgoing file should come with populated values in them using property demotion.

In this case, I want to populate CompanyName, City from Header part and File path location from the system promoted property InboundTransportLocation.

So our input file contains empty nodes like below


So when this envelop message comes into BizTalk, we have to debatch it with following conditions

1. “CompanyName” and “City” fields values from the header part should be copied to every out going individual message in to the fields of “CompanyName” and “City” respectively.

2. File received location path(the path where the input file was dropped) should be set to FileReceivedLocation element on every outgoing message.

Now that you have imported the schema into envelope schema , select the Root node in envelop schema and set the BodyXpath property to the node “Body”.

Now we will dive into property promotion and demotion. We need to promote the fields now. Because they should be available in the context so as to demote them and write them to outgoing message in send port.

In Employees envelop schema, promote the two properties “CompanyName” and “City”. You may use quick promoted option to create the property schema auto created.

Now the following step is important, we will promote elements from EmployeeInfo schema into already created fields in property schema.

So open EmployeeInfo schema, right click on CompanyName element –> Promote –> and select show promotions options. In the opened window, click on PropertyFields tab
Now click on folder open icon and import/refer following two things

1. refer already created property schema

2. refer system global property schema “BTS.bts_system_properties” (you have to select from references section in the window) and click OK.


3. Now from the window add the fields “company”, “city” and “FileReceivedLocation” to promote them. Now here make sure you set the right node for the Node Path section. By default it selects first element, change as per need.

4. For FileReceivedLocation property, set inboutTransportLocation property

At the end it should look like below


Now create a receive pipeline to process this XML envelop, deploy the solution. Set up ports, set pipelines, set filters etc.

NOTE: you should not use passthru at send side, otherwise it is not demote properties into outgoing messages.

Create sample envelop instance with few messages inside the envelop. (make sure you set the required fields empty as explained earlier)
Drop the message in receive location, once processed you should see output files with the fields “CompanyName”, “City” and “FileReceivedLocation” fields having values.

For example I am dropped the following envelope containing 3 messages inside,


Notice that I have set the required few fields empty,(it is required).

Once I dropped them, the envelop got debatched and produced 3 output files


And the outgoing message contains the field values which are demoted from the context.


Keep following things in mind if you follow the above example

1. You must and should keep the required nodes with empty tags in the input file to work this scenario/example.
2. If you do not keep empty nodes (I,e if you keep some values) then you will not get the values from header/system properties whatever.. .. you will get the same value that you set in the input file
3. If you do not keep the empty node itself in the input file, the output node itself is not created.

4. for cases like in example 1, no need to keep elements with empty tags in incoming file as we are demoting into outgoing message Header section.

In what cases property demotion happens?

i noticed that if multiple schemas share the same fields in property schema, property demotion attempt happens.

in our case

1. we have promoted 2 elements in envelop schema from header “CompanyName” and “City” .  so 2 fields are created in newly auto created property schema.

2. we have promoted 2 elements from document schema “CompanyName” and “City” into the same fields in property schema which are created in step 1.

3. we have promoted FileReceivedLocation field in to the biztalk global property schema “BTS.bts_system_properties”.

so, for one field in property schemas(be it custom or BizTalk Global property) if there is a match from multiple schemas, then in such cases property demotion attempt happens.

There may be other cases too depending on requirement, I am still exploring things on this topic, your ideas, inputs are welcome.

March 12, 2014 Posted by | Uncategorized | Leave a comment

View BizTalk artifacts with WMI

Today my colleague Satendra told me a wonderful feature of WMI ability to view BizTalk artifacts information.
Thankful to him for sharing it with me.

Go to command prompt and type “wbemtest”
this will open a window like below

View BizTalk artifacts with WMI

click on connect, this will open another window. Enter namespace root/MicrosoftBiztalkServer as shown below and click connect

BizTalk_with_WMI _2

once connected, it will open a window like below. Now click on “Enum Classes”

BizTalk_with_WMI _3

This will open a dialog box like below, don’t enter any thing in the text box. Just select “Recursive” option like below and click OK

BizTalk_with_WMI _4

this will open a window like below. Scroll down until you see biztalk resources and double click on any one. i choose send ports like below.

BizTalk_with_WMI _5

this will open a window like below

BizTalk_with_WMI _6

Now click on “instances”, this will open a window listing all available send ports (it takes few seconds to list them)
BizTalk_with_WMI _7

Now double click on required send port . This will open a window like below

BizTalk_with_WMI _8

Now click on “Show MOF”, this will open a window
like below.
BizTalk_with_WMI _9

This is where all the port information is displayed. Scroll down through the window to see all properties.
Similarly follow the same steps for other artifacts as well.

September 3, 2013 Posted by | Biztalk Server | Leave a comment

Disable all artifacts of a particular Biztalk application using powershell

the following code disables all recieve locations for a particular specified BizTalk application named “MyBizApp”

Function Invoke-BizTalkEOM
$BizTalkConnectionString = "SERVER=.;DATABASE=BizTalkMgmtDb;Integrated Security=SSPI"
if ( ( Test-Path "HKLM:SOFTWARE\Microsoft\Biztalk Server\3.0\Administration" ) -eq $true )
 $BizTalkMgmtDBServer = ( Get-ItemProperty "HKLM:SOFTWARE\Microsoft\Biztalk Server\3.0\Administration" ).MgmtDBServer
 $BizTalkMgmtDBName = ( Get-ItemProperty "HKLM:SOFTWARE\Microsoft\Biztalk Server\3.0\Administration" ).MgmtDBName
 $BizTalkConnectionString = "SERVER=$BizTalkMgmtDBServer;DATABASE=$BizTalkMgmtDBName;Integrated Security=SSPI"
$BizTalkCatalogExplorer = New-Object Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$BizTalkCatalogExplorer.ConnectionString = $BizTalkConnectionString
return $BizTalkCatalogExplorer
$BizTalkCatalogExplorer = Invoke-BizTalkEOM
 $BizTalkApplication = $BizTalkCatalogExplorer.Applications[$name]
 $BizTalkApplication.Stop([Microsoft.BizTalk.ExplorerOM.ApplicationStopOption] ("DisableAllReceiveLocations"))

if you want to disable other artifacts also, you can add parameters like below

$BizTalkApplication.Stop([Microsoft.BizTalk.ExplorerOM.ApplicationStopOption] ("DisableAllReceiveLocations","UnenlistAllOrchestrations","UnenlistAllSendPortGroups","UnenlistAllSendPorts","UndeployAllPolicies"))

July 5, 2013 Posted by | Powershell with Biztalk | Leave a comment

Get Biztalk serviceInstance details with Powershell

To get all service instance details of Acitive/readytorun/suspended(resumable and non resumable), dehydreated, use following command

Get-WmiObject -Class "MSBTS_ServiceInstance" -Namespace 'root\MicrosoftBizTalkServer' | Where-Object { $_.Item -match "$Name" -and $_.Item -ne "" -and ($_.ServiceStatus -eq "1" -or $_.ServiceStatus -eq "2" -or $_.ServiceStatus -eq "4" -or $_.ServiceStatus -eq "8" -or $_.ServiceStatus -eq "16" -or $_.ServiceStatus -eq "32")  }

it will display all service instances with following details for every instance


And if you want to know the count of all Biztalk application’s current Acitive/readytorun/suspended(resumable and non resumable), dehydreated messages, then use following command

$a=Get-WmiObject -Class "MSBTS_ServiceInstance" -Namespace 'root\MicrosoftBizTalkServer' | Where-Object { $_.Item -match "$Name" -and $_.Item -ne "" -and ($_.ServiceStatus -eq "1" -or $_.ServiceStatus -eq "2" -or $_.ServiceStatus -eq "4" -or $_.ServiceStatus -eq "8" -or $_.ServiceStatus -eq "16" -or $_.ServiceStatus -eq "32") } | measure

And if you want to get the number of service instance for a specific biztalk application, then use following, just replace the application name between the 2 star symbols in the parameter value for  Assembly name

$_.AssemblyName -like "*MyApplication*"

with your appropriate Biztalk application name

just similar to below

$a=Get-WmiObject -Class "MSBTS_ServiceInstance" -Namespace  root\MicrosoftBizTalkServer' | Where-Object { $_.Item -match "$Name" -and $_.Item -ne "" -and ($_.ServiceStatus -eq "1" -or $_.ServiceStatus -eq "2" -or $_.ServiceStatus -eq "4" -or $_.ServiceStatus -eq "8" -or $_.ServiceStatus -eq "16" -or $_.ServiceStatus -eq "32") -and $_.AssemblyName -like "*MyApplication*" } | measure


July 5, 2013 Posted by | Powershell with Biztalk | Leave a comment

How to View assemblies in GAC folder and take back up of them

run following command


June 14, 2012 Posted by | Asp.Net, Biztalk Server, Uncategorized | Leave a comment