Have you looked at the SDK example working with Envelopes in BizTalk 2004 for Flat Files and tried to get it to work with XML Documents? Well, I did and I found it a little trickier than I expected.

Key Take Home Points:

– De-Batching / Envelope Processing for XML Document must take place on the Receive Port. I have not been able to get it to work onthe Send Port, but I am still trying.

– Properties can be promoted from the Header and demoted to the single messages

– No custom pipelines are required for Receive Port Processing as long as the Root Node Name and Namespace are unique throughout your entire deployed solutions.

DOWNLOAD: Get the sample here!

Set-up is easy, just unzip the SampleEnvelopes folder and put it on your C: drive. Then, build and deploy the SampleEnvelopes project. I use early binding so the send and receive ports will be created for you.

To run the sample, drop the start messages named StartFileInbound.xml into c:\SampleEnvelopes\In_Inbound. You will get 3 messages inthe Out_Inbound folder for each start message. Also, note that the Orchestration will run 3 times. Plus, I promote and demote Header information to show how it can be passed into the single messages. If all else fails, read the ReadMe.txt file.

Take Away: Once you get the hang of XML Envelopes in BizTalk 2004 they can be a powerful tool for easy document splitting.