Multipart Messages

This is tricky.. As far as I know this is quite poorly in BizTalk. Considre the scenario: I have an existing solutuion where the core component takes a multipart message. This consists of 3 parts.

Now I whant to expand the solution and utillize this core component. This means that the new orchestration needs to submitt a multipartmessage to the core. The core component needs to receive the message with the parts in the same order as its own mulitipart message is defined.

Lets say the parts are : EmailBody, EmailOriginalAttacment, and EmailProcessedAttachment. In order to get the two orchestration to talk to eachother the new mulipartmessage parts have to be created in the same order as the original one. It is not enough to call them the same and populate them wiht the correct content.

This means that for a 3 part message there are 3! = 6 numbers to define the message. And hopefully you dont do as I and find the correct on the fifth attempt. If you just at one more part you have 4! = 24 different ways to define the message.

So the lessen would be that whenever you create a multipart message you have to write down the order you crerated the parts..

When deploying a wcf service to biztalk the is a good chance you will run into:

The Messaging Engine failed to register an adapter "WCF-BasicHttp". Details: "Registering multiple adapter types within the same process is not a supported configuration. For e.g. HTTP and SOAP receive adapters cannot co-exist in the same process"

Solution
When installting a SOAPm HTTP or WCF service on the same WebServer then seperate app pools must be created for each adapter. Using seperat app pools will solve the issue. Note the this is only a problem om win servers as desktop version of windows does not have an app pool concept.

One of the easiest ways to update a bam activity from an orchestration is to use the BAM API, Simply add reference to

Microsoft.BizTalk.Bam.EventObservartionMicrosoft.BizTalk.Bam.XLANGs
to your project and you are ready to start.
In the basic level you have to start, update and end an activity.

Start Activity
I reccomend creating variables for activity name and instanceID, To avoid any confutions. The Activity name must match the Activity name created and deployed using bm.exe. (I will create a seperate post for this)

The code in start-bam-expression-shape in orchestration PreProcessInvoice will then look something like this:

activityName = ("ProcessInvoice");//this is the activity we are loading data intoactivityInstance = System.Convert.ToString(System.Guid.NewGuid())+"PreProcessInvoice"; //if bamming to same activity from different orchestration, we may track where the data is comming from by adding orchestration name.