Thursday, May 12, 2005

Visual Message Instance Creator - BizTalk Needs One!

Scott Colestock has highlighted an important point that often causes me consternation with BizTalk: creating a new message instance from scratch in an orchestration. I generally hard code the skeleton xml and load it up in to an XML document then assign the attributes using promoted properties or xpath (see Scott's post on how it is done).

What would be really nice however, is to have a visual way to construct message instances. Here we are dropping shapes on to orchestrations in a very visual way only to disrupt this harmony by having to handcraft xml and embed it within an expression shape!

But what I find really frustrating is that BizTalk is so close to having a visual message instance creation tool already available out of the box; its the mapper. If Microsoft could just tweak the mapper, as explained below, it would be so easy and a far more natural way to create message instances.

  1. It should be optional as to whether a source schema is required on the left hand side. In many cases when creating a new message you just don't need one
  2. There should be a new functoid to access message context properties. Drop one on to the pallete, indicate which context property you want and then link it to an element on the destination schema
  3. There should be a new funtoid to access orchestration variables. This would be used in a similar way to the context property functoid above
  4. Some other functoids would be useful such as "static value" functoids where a value can be hard coded in to it

This way it will be possible to visually construct a new message instance without the need of having a source message instance to seed it. These message instance definitions should not be stored in a separate xml file, as the maps currently are, but stored within the orchestration xml file instead. This would help to keep them self contained within the orchestration and reduce the number of files created in your project. Even better would be a new orchestration shape to represent them. Simply double click it and your message instance creation definition would open up.

Because BizTalk is managing the definition it can also do error checking on it. So when you change the destination schema BizTalk would know about it and flag it up as an error. This would at a stroke eliminate those awkward hard to find bugs when using handcrafted xml.

Wednesday, March 16, 2005

BizTalk Script Adapter

After finding myself in several similar situations where I needed to get a job done quickly with BizTalk but it just wasn't playing ball, I decided to do something about it. I developed a send adapter for BizTalk that integrates with Windows scripts.

Because scripting is so easy and fast, I find that for certain tasks, productivity can go through the roof using the Script Adapter. Simply develop a script (say using VBScript) and implement a procedure called OnMessage where all your code goes. Then, when BizTalk receives a message and forwards it on to the Script Adapter it will load your script and call your OnMessage procedure. Simple as that.

For a two way send, just return a string value from the procedure. The Script Adapter converts the string in to a message and returns it BizTalk.

Be warned, this is a first release. Consider it a beta. So I would appreciate feedback on it.

You can get the Script Adapter at my employer's website, Thinkscape: Download the BizTalk Script Adapter.

[Update 2007-07-30 - Note that the Script Adapter was previously hosted at Got Dot Net but Microsoft has closed the site down. Thinkscape have been kind enough to host the adapter, and even better, they will be providing support and working on enhancements - and it's still free!]

Note that on installation of the Script Adapter there is a choice to install it for Everyone or Just Me. Sometimes I have found that selecting Just Me can cause issues when you come to register the adapter with BizTalk (something to do with registry access permissions I think). Therefore to be on the safe side install it for Everyone

There is a guide included with the installation that walks you through setting up the samples. That should hopefully clue you up enough to develop your own scripts for the Script Adapter.