What is debatching?
Suppose you are receiving a BizTalk Message that contains multiple records. In order to process the message and update or send to particular system (DB or any other Application) we need to process this message individually this process called debatching in BizTalk.
How BizTalk helps ?
In BizTalk using Envelope Schema, Document schema we can process or break a message individually .
Steps Needed to Achieve this.
1) First Create document schema which has all the elements of the XML message. and call this schema as Contact.XSD
Here I am going to use The following XML Message
2) Create Envelope schema and name it Contacts
Now select Schema node in newly created schema and set Envelope Property to "YES" as shown above.
Now we need to Import Contact Document schema into Envelope schema.
Now add child record and name it Contact and change the Data structure type to Contact as shown below.
Now change the Body Xpath to /*[local-name()='Contacts' and namespace-uri()='http://XmlDebatching.ContactsEnvelope']
Now create custom Receive Pipeline with XML Disassembler as shown below.
and Change the document schema to Contact.XSD and Envelope schema to ContactsEnvelop.XSD.
finally Add Strong Name key file to the project and Deploy into BizTalk Message DB.
Create Receive Port with the custom pipeline we created and Send port with Filters and test the application.
Now drop the Contacts.XML in Receive Location and BizTalk Read the message and Split into individual messages as shown here.