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.

10 comments:

Anonymous said...

hey this worked well, thanks for adding instructions.

I can see how this can get you out of a bind, BizTalk can take 20 minutes to do something or 3 days, you often never know. This can get you from A to B, in the mean time work on a compiled solution.

Also might be interesting to try this for deployment...

McGeeky said...

That's really great. I'm glad it helped you. You have hit on a good usage scenario: that is to use it to get you out of a tricky spot whilst working on its compiled cousing that is suitable for the longer term.

I have noticed that gotdotnet workspaces has had very intermitent availability so I am uploading the script adapter to user samples too as it appears to be more stable.

Anonymous said...

Thanks for the Script Adapter.I am trying to run the sample you provided.I am getting the following error.

The adapter failed to transmit message going to send port "Script://VBScript/C:\Program Files\McGeeky\Script Adapter\Samples\DumpMessage.vbs". It will be retransmitted after the retry interval specified for this Send Port. Details:"Invalid procedure call or argument".

Can you please take a look at it.It is coming as warning in Event log.And Output is not being produced.

Thanks & Regards,
Seshu

Anonymous said...

I was able to install the Script adapter fine.When I am trying to use in in my project it is giving me errors.

I created a VBScript to run a batch file.I created a one way send port.But it is not producing anything.It is not throwing any exception as well.Is there any permissions that I need to net.

Here is my code in VBScript:

Sub OnMessage (Message, Configuration)


set shell = createobject("wscript.shell")
doscmd = "C:\test.bat"
'shell.run "%comspec% /c " & doscmd & " >>output.txt"
Set objCmd = shell.Exec(doscmd)



End Sub

Do you know what might be happening.

I appreciate your help in advance.

Anonymous said...

How do you send parameters to Script Send Adapter from inside orchestraion.(Dynamic Send Port).

McGeeky said...

Can you get the script adapter working with the samples provided?

I was able to install the Script adapter fine.When I am trying to use in in my project it is giving me errors.

I created a VBScript to run a batch file.I created a one way send port.But it is not producing anything.

McGeeky said...

Hi Seshu. Have you installed the Windows scripting component? Its a little difficult to diagnose your problem with the information that you have provided.

All I can suggest at this stage is to uninstall the adapter and try reinstalling again.

If you have any more information then please post it here.

Seshu said...
Thanks for the Script Adapter.I am trying to run the sample you provided.I am getting the following error.

McGeeky said...

How do you send parameters to Script Send Adapter from inside orchestraion.(Dynamic Send Port).

The best way to pass parameters is by promoting properties on the message. You can then access these from your script. See the sample provided.

Unknown said...
This comment has been removed by the author.
Anonymous said...

Hi

The BizTalk Script Adapter is no longer available at the URL provided above.

I am converting an older job that uses vbscript to BizTalk and this would be ideal.

Thank you
Colin