Click here to Skip to main content
13,295,643 members (32,549 online)
Click here to Skip to main content
Add your own
alternative version


7 bookmarked
Posted 24 Dec 2012

Envelope Schema and Debatching

, 27 Dec 2012
Rate this:
Please Sign up or sign in to vote.
Debatching the messages in BizTalk


Hi all, I am so glad  that I am submitting my very first article over internet. The reason being from the day  I started learning this technology , I found that very less internet support for the BizTalk technology as compared to other technology that are there in the market. So it is just an attempt  from my side to provide a potential learning  support  towards the technology. 

I scratched my brain over a days to understand the concept (debatching) which I am going to speak in a while. I read few books but none of them are able to give the clear cut idea about what exactly the concept is meant for. So  I am explaining  the same concept in very brief manner... Happy reading ... 

The  concept which I am going to share is debatching  a message using envelope schema in BizTalk server. The moment we here the term debatching, first question that  hits our mind is what is debatching? All right let me address that first and move forward.

In simple words debatching is the process of extracting the individual message/record from a file that contains multiple records/messages and creating different separate files for all those individual message/records to process them separately. For ex: Say supposing there is an XML file that contains order details of three orders. Please look at the below XML file :


So if I give the file that contains above order  details as input to my application, what debatching says is that I should get 3 separate individual messages each containing its own order detail like this:





Sounds cool,So how can we achieve this debatching pragmatically in our biztalk? The solution to this is biztalk achieves debatching through envelope schema. So lets learn about envelope schema. Envelope schemas are the normal schemas which provides you an ability to define the container schema that wraps number of child schemas (In our ex. its the schema that defines individual orders). Its is this envelope property of the normal schema that allows you to access the child records(order) individually and process those individually.

Let's look at the structure of both child schema (OrderSchema.xsd) and envelope schema (OrderEnvelopeSchema.xsd) that wraps the child schema.



Steps to create such application:

a. Create a schema for the record or message which you want repeat that in the input file. In my case it is OrderSchema.xsd.

b. Create envelope schema (It ll be explained in detail later in the article)

c. Test your input through command line tool xmldasm.exe 


a. Create a schema for the record or message which you want repeat that in the input file. In my case it is OrderSchema.xsd.  

1. Open Visual Studio choose empty BizTalk template, add new project and name it as BatchProcessing.sln

2. In Solution Explorer right click on the BatchProcessing project add new item add a schema and name it as OrderSchema.xsd

3. Rename the root node to Order.

4. Right click on the Order root node then insert schema node and insert child element and rename it as OrderId

 5. Repeat the step 4 and rename the node as OrderAmount. Go to file menu and save all .

So the ultimately the structure should look like OrderSchema.xsd image.

b. Create envelope schema. 

1. Right-click the project, and select Add  New Item to open the Add New Item dialog box.
2. Select Schema Files from the BizTalk Project Items category and Schema from the list of templates. Enter a descriptive name for your new schema and then click Add. In this case, OrderEnvelopeSchema will be used.
3. Right-click the Root node of the new schema, and change it to the root name of the incoming schema containing the batch of records (OrderEnvelope in this example).
4. Right click the Schema node (directly above the newly renamed root node), and change the Envelope property of the schema to Yes (in the Properties window). 
5. Right-click the newly renamed root node, and select Insert Schema Node Child Record, Child Field Attribute, or Child Field Element, to add the appropriate envelope elements. In this example, a child field element named BatchID and a child record named Orders, which will contain the child records  which we are going to send in our input document.
6. Right-click the record that will contain the child records (Orders in this example) and select Insert Schema Node ➤ Child Record to add a container for the child records. In this example, a child record named Order is added.

7. Right-click the container child record (Order in this example), and select Insert Schema Node  Any Element to add a placeholder for the child elements. The resulting envelope schema has the structure shown in Figure OrderEnvelopeSchema.xsd

8. Click the root node (OrderEnvelope in this example), and click the Body XPath property of the schema (in the Properties window), which will open the Body XPath dialog box.

9. Navigate through the schema structure displayed in the tree view, and select the container record for the child records you wish to process individually (the Orders record in this example), as shown in below Figure Then click OK.

 So tats it..  Go to  file menu save all the solution, now our both schemas are ready to test the input.

c. Test your input through command line tool xmldasm.exe  

xmldasm.exe is the command line tool provided by BizTalk to test the debatching over command line with out being deployed our solution in Admin console.

1.Go to C:\Program Files(*)\Microsoft BizTalk server 2010\SDK\Utilities\PipelineTools copy both xmldasm.exe and PipelineObjects.dll to the folder where you have your schema files.


 If you don't want to copy the files the alternative way is goto command prompt just type

path = %path%;”C:\Program Files (x86)\Microsoft BizTalk Server 2010\SDK\Utilities\PipelineTools”  hit enter.

(Here we are just setting the path environment variable to the OS .lets not worry about that much)

 2. Copy the input file and paste under the same directory. Your input file ll look like: (Orders.xml

Notice that the input file contains three order details along with that it is wrapped up by the body header that is OrderEnvelope. This is because of the reason we are going validate our input file against the envelope schema before debatching , As out envelope contains some header information our input xml file also should contain the same in order to by pass.

2. Open command prompt and execute the following command : xmldasm Orders.xml -ds OrdersSchema.xsd -es OrderEnvelopeSchema.xsd -c hit enter.

The preceding command uses the xmldasm utility; xmldasm is used to simulate the use of an XML disassembler component in a pipeline. The parameters used are: message (Orders.xml), -ds (documentschema = OrdersSchema xsd), -es (envelope schema = OrderEnvelopeSchema.xsd) and –c (display results in the console). 

This will display the debatched message on the console. 

Thanks for your time . Appreciate your valuable feedback for improvisation in upcoming article...       


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Suprith A.M
Software Developer (Junior) Wipro Technologies
India India
For any doubts and clarification regarding the article,Please reach me out at

You may also be interested in...

Comments and Discussions

Questiondebatching and batching Pin
Amit Patel198514-Mar-15 9:08
memberAmit Patel198514-Mar-15 9:08 
GeneralVery detailed and descriptive Pin
rkkota3-Aug-14 16:12
memberrkkota3-Aug-14 16:12 
QuestionNice Article Pin
RatnakarSinha22-May-14 4:20
memberRatnakarSinha22-May-14 4:20 
QuestionGood Article Pin
Shrilata Ellaboina10-Nov-13 23:59
memberShrilata Ellaboina10-Nov-13 23:59 
AnswerRe: Good Article Pin
Suprith A.M12-Nov-13 4:27
memberSuprith A.M12-Nov-13 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171207.1 | Last Updated 27 Dec 2012
Article Copyright 2012 by Suprith A.M
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid