Biztalk 2004 Integration Experiences

Monday, February 21, 2005

Beware while using Archived Database Option in HAT

I am using HAT (Health and Activity Tracking) a lot for debugging and trouble shooting in my apps.

I noticed something recently which appears to be a bug in HAT but digging deep I found it was by design.

I was using HAT to remotely connect to an Archived Database (You can do this from Tools->Preferences from HAT). Most of the options in HAT, Including the Orchestration Debugger (For an orchestration which has already completed) worked great i.e.) pulled the data from the Archived Database.

The Problem is with the form opening from menu Operations->Messages. This still points to the current Database rather than the Archived Database.

Biztalk documentation clearly states the following menus are only HAT for Archived messages and the other menu's are just for live data.

Query Builder
Find Message

Wednesday, February 16, 2005

Updated Biztalk 2004 Map Testing Tool with External Assembly Support

I recently blogged an article about a tool I use for testing Biztalk 2004 Maps. You can see that blog here

The tool worked fine for Inline Script/XSLT mappings but it did not work well if you use External assemblies in your map. So I had some time this week to correct this.

I have an updated tool which should support all the type of Biztalk maps. If you are interested, pls post a comment, I'll send you the updated tool.

Tuesday, February 15, 2005

Just don't promote any Property in your Schema

Yes, one of the Issues I recently faced in my current solution is an Error message like this in the event log while subscribing a message submitted by another system.

There was a failure executing the receive pipeline: "Microsoft.BizTalk.DefaultPipelines.XMLReceive" Source: "XML disassembler" Receive Location: "/test/testHTTPReceive.DLL" Reason: The property 'errordesc' has a value with length greater than 256 characters.

The issue was I had promoted a property called "errordesc" which is basically the Error Description field. This error happened when the errordesc field in the xml file was greater than 256 characters.

I noticed that Biztalk Documentation clearly states that do not promote a property whose length is greater than 256 characters and this is a limitation (or by design) in Biztalk 2004, but somehow I overlooked it.

I guess this is worthwhile of a support article for Biztalk since lot of people might have overlooked this limitation.

Thursday, February 10, 2005

Biztalk WSE 2.0 Adapter Released

Microsoft has released the BizTalk 2004 Adapter for Web Services Enhancement (WSE) 2.0 yesterday.

You can get it here

This is great news since publishing BizTalk orchestrations as Web services can be more secured and use a bunch of security stuff provided by WSE 2.0.

Tuesday, February 08, 2005

Potential Pitfall in Business Rule Composer

I was replying somebody in the Biztalk Server newsgroup, which reminded me that it's worthwhile to post about a potential pitfall in Business Rule Composer.

While dealing with XML Schemas in Business Rule Composer, it allows you to select a xsd (Schema) file from a local folder(like Schema1.xsd). Beware of this!

The Document Type property in the Property editor is filled in with just the name of the file (for ex: schema1) Instead of putting the fully qualified name like project1.schema1

You have to change it as fully qualified by editing the property in the property editor.

If you don't do this, the Policy will not list in the CallRules shape if you decide to call this from an orchestration.

Monday, February 07, 2005

Restart all Biztalk In-Process Hosts using WMI

I am currently working on a Deployment Tool which can handle both BTS Assemblies Un-Deployment/Deployment with support to remove/add referrenced assemblies.

I started writing this tool in C#, still working on it and quickly noticed the value for common generic functions to help with Deployment/Un-Deployment.

The following C# Code illustrates how all the Biztalk In-Process Hosts can be re-started using WMI.

private static void RestartBiztalkInprocessHosts()
{
System.Management.EnumerationOptions enumOptions =
new System.Management.EnumerationOptions();
enumOptions.ReturnImmediately = false;
// HostType = 1 for In-Process Hosts
string strQuery = "Select * from MSBTS_HostInstance where HostType=1";

System.Management.ManagementObjectSearcher objSearch =
new System.Management.ManagementObjectSearcher
("root\\MicrosoftBizTalkServer",strQuery,enumOptions);

foreach(System.Management.ManagementObject inst in objSearch.Get())
{
//Check if ServiceState is 'Running'
if(inst["ServiceState"].ToString() == "4" )
{
inst.InvokeMethod("Stop",null);
inst.InvokeMethod("Start",null);
}
//Check if ServiceState is 'Stopped' or 'paused'
if(inst["ServiceState"].ToString() == "1"
inst["ServiceState"].ToString() == "7" )
inst.InvokeMethod("Start",null);
}

if (objSearch!= null)
objSearch.Dispose();
objSearch = null;

}

Friday, February 04, 2005

How to Get Length of a Message Field in an Orchestration?

The title question might sound a bit stupid, but one of the main limitations I have seen with the Xlang C# Pseudo syntax in Orchestration is it lacks certain simple programming abilities.

For example in C# if you want to find length of string you can easily do it as below

string strTest = "Test string";
int intTestLen = strTest.Length;


You cannot do the above in the Expression Editor or Message Assignment shape in an Orchestration, which is frankly a bit disappointing.

So if you have to find a length of a field in a message, the proper thing to do would be to send that message to a custom .Net Assembly and get the length back.

To me it sounds it's a lot of work for just finding the length of string, so I tried something else.

I used the xslt "string-length" function in xpath function (Which is very powerful and useful in Orchestration) to fetch the length of a field. for ex. if msg1 is your message and field1 is the field whose length you want to find, you can write the statement as below in a Expression editor to get the length

intTestLen = xpath(msg1,@"string-length(/Test/field1/@value)");

This is just a workaround and to me it's convenient than passing the message to a .Net component

Thursday, February 03, 2005

Creating Biztalk 2004 Service Restart Batch File

I wrote some useful tools and utilities recently.

One of them was a batch file which can restart the default Biztalk Server NT Service. This provides a great value when deploying assemblies to my local box and also to avoid various cache issues.

The Batch file looks like this (It's just usual net stop and start commands)

net stop BTSSvc{088886359-D424-4853-BCCB-B2F887F1F86D}
net start BTSSvc{088886359-D424-4853-BCCB-B2F887F1F86D}


The Interesting thing is if you just copy the above two lines and put it in a batch file, it won't work. Hmm why?

Do you notice the GUID in the above batch file. This is different for each machine and each host (yes, 1 physical NT service is being created for every In-Process Host). You can get this GUID from the Services mmc snap-in (The Service name starts with "BizTalk Service BizTalk Group :")