Create applications using PowerShell provider for BizTalk

8 January 2009

I wrote a small article that shows how to create BizTalk applications using my PowerShell provider for BizTalk. You can find it here.


Promoting values from envelope to body

7 January 2009

I might be stating the obvious in this post but it took me and my colleague quite a while before we found what we were doing wrong. We wanted to disassemble the body messages from an envelope message and promote a value from the envelope to each body message. Not exactly rocket science :-) .

Lets take the following schema and corresponding message as example:

Envelope_Schema_wrong

Envelope_Message_wrong

In this sample the value of the ‘FamilyNumber’ element from the envelope has to be promoted to the context of each body message. Ok, very easy…… we thought.

This can be done using build in BizTalk functionality. Create a property schema, promote the element from the envelope, use the default XmlReceive pipeline to promote the value from the envelope to each body message and done.

After the first test run We were very surprised to see that none of the context messages of the disassembled bodies contained the promoted value. It took an embarrassing long time before we found out that the element to promote needs to be before the body messages instead of after the body messages.

It makes sense because the XmlDisassembler component in the XmlReceive pipeline works in a streaming forward only manner. Each time a complete body message is read from the stream it is delivered to the message box (or next pipeline component). So when the stream reaches the element to promote the bodies have already been delivered to the message box. This is why their message context does not contain the promoted value.

Changing the schema to:

Envelope_Schema_good

will do the trick.


PowerShell provider for BizTalk (version 1.0.0)

6 January 2009

In an earlier post I wrote about the PowerShell provider for BizTalk that I’ve been working on in the past months. I’m very proud to release the very first version now. Please note that this is still a very, very, very early ‘alpha’ release. In other words it is full of bugs and not as feature rich as I wanted it to be at this time ;-) .

The PowerShell Provider for BizTalk lets you browse BizTalk as a file system. The primary goal for writing this provider is to aid me in my day to day BizTalk development work. With this in mind the first thing I wanted to be able to do is stop, start and restart host instances in an easy manner. I also wanted to replace my host manager tool with something with more flexibility. You can read more on host instances and PowerShell here.

Download link can be found here

Some features:

- Browseable BizTalk Adminstration Console like hierarchy and structure of artifacts. Read more here

- Tab completion saves you from a lot of typing

- Custom cmdlets aimed at BizTalk.

Installation instructions:

prerequisites: PowerShell 1.0 installed, BizTalk Server 2006 R2 (haven’t tried R1 yet) installed and configured.

steps:

1. run ‘PowerShell.BizTalk.msi’ and follow instructions.

2. Start a new PowerShell shell.

3. Type the command:

Add-PSSnapin PowerShell.BizTalk

4. Optionally verify that the snap-in is loaded by executing the command:

Get-PSSnapin

You should see the snap-in in the list of loaded snap-ins (see example below).

image

5. Add a connection to the local BizTalk installation by executing the command:

New-PSDrive LocalBTS BizTalk LocalBTS: -scope global -server <ServerName> -database <DatabaseName>

Replace <ServerName> and <DatabaseName> with the name of the server and database with the name of the management database.

For example:  New-PSDrive LocalBTS BizTalk LocalBTS: -scope global -server BizTalk01 -database BizTalkMgmtDb

This will create a new PowerShell drive object pointing to the BizTalk management databases.

 

Automatically load the snap-in:

Step 3,4 & 5 need to be executed every time you start a new PowerShell and want to use the BizTalk provider. To prevent you from typing the commands every time you can of course create a personal profile script. This will be loaded every time a new PowerShell shell is started. In order to do this:

1. Create a new folder in your ‘My Documents’ folder. Name this folder ‘WindowsPowerShell’.

2. Create a new text file in the folder created in step 1. Name the file ‘Microsoft.PowerShell_profile.ps1′.

3. Set the contents of the text file like below and save it.

image

When opening a new shell the snap-in should be loaded automatically.

 

Supported artifacts:

Compared to BizTalk Adminstration Console this release of the provider has a limited set of artifacts that are browseable. Also each artifact has less properties than you’re used to in the console.

artifact artifact supported in v1.0.0
Applications browse (limited properties), create, delete
Orchestrations browse (limited properties)
Role Links -
Send Port Groups -
Send Ports browse (limited properties)
Receive Ports browse (limited properties)
Receive Locations browse (limited properties)
Policies -
Schemas -
Maps -
Pipelines -
Resources -
BAS Artifacts -
Parties -
Hosts browse (limited properties)
Host Instances browse (limited properties), custom cmdlets to stop, start and restart.
Servers -
Message Boxes -
Adapters -

Limitations in this version:

- The provider makes heavily use of ExplorerOM model. As far as I know this is only supported on 32 bit platforms. So be aware when using the provider on a 64 bit platform.

- The provider does not (yet) (fully) support connections to remote BizTalk installations. Some things like e.g. browse applications work, while other browse host instances will not work.

- Make sure you have enough rights (BizTalk administrator) before using the provider. It does not check role membership or authorizations before executing code so insufficient rights may lead to nasty errors.

- Many other……

Please send me an e-mail or post a comment if you have questions, remarks, bugs, etc…


Follow

Get every new post delivered to your Inbox.