Click here to Skip to main content
Click here to Skip to main content

Tagged as

Split XML Interchanges on BizTalk

, 20 Apr 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
How to split XML Interchanges on BizTalk

Introduction

An interchange is a group of messages that are contained within one larger message. In this post, I describe how to split an XML interchange into individual messages to be processed and saved to the MessageBox on BizTalk Server.

The interchange and the messages

The interchange in this case is shown below.
<Envelope Type="Updates" xmlns="http://Stm.Messaging.Schemas.Updates">
   <Updates>
      <CompanyUpdate CompanyID="1" Name="Company A" Address="Street 1" />
      <CompanyUpdate CompanyID="2" Name="Company B" Address="Street 2" />
      <CompanyUpdate CompanyID="3" Name="Company C" Address="Street 3" />
   </Updates>
 </Envelope>
The interchange will be split into single CompanyUpdate messages.
<CompanyUpdate CompanyID="1" 
               Name="Company A" 
               Address="Street 1" 
               xmlns:ns0="http://Stm.Messaging.Schemas.Updates" />

Create an envelope Schema

The first thing to do is to create an envelope schema. This can easily be done by using the Add Generated Schemas in Visual Studio and generate a schema from the interchange. In the schema node, set the Envelope property to Yes. In the root node (In this case Envelope node), set Body XPath property to the parent node of the body messages. (In this case, the Updates node) In the body messages node (CompanyUpdate node), set Data Structure Type property to xs:anyType. In this example, I have also set the Target Namespace to the Schema.

Create a Schema for the individual messages

Create a CompanyUpdate Schema (Add Generated Items) from an individual message.

Deploy and test

Deploy the two schemas and use the XMLReceive pipeline in a receive location. This will split the interchange into individual CompanyUpdate messages with
Target Namespace = "http://Stm.Messaging.Schemas.Updates"
and
Root Node = "CompanyUpdate"

License

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

Share

About the Author

No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141220.1 | Last Updated 20 Apr 2011
Article Copyright 2011 by Steinar Moen from Norway
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid