Debathing File Document Schemas and Envelop Schema in Biztalk

Wednesday, September 14, 2011

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
<Name>Sreeni</Name> 
<Age>35</Age> 
<Email>sragavan@hotmail.com</Email>
<Name>Gandhi</Name> 
  <Age>35</Age> 
  <Email>Gandhi@india.com</Email>
2) Create Envelope schema and name it  Contacts
image
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.
image
image
Now add child record and name it Contact and change the  Data structure type to  Contact as shown below.

image
Now  change the Body Xpath  to /*[local-name()='Contacts' and namespace-uri()='http://XmlDebatching.ContactsEnvelope']
Step 3:
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.

image
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.
image
image

image

No comments:

Post a Comment

Post Your Comment...