Envelope Schema is a special type of schema used in BizTalk Server that is used to represent more than one XML messages embedded in it.
You can use Envelope schema to Split up a Batch XML into individual Files or Split up an XML file that has more that one Embedded XML files into individual Files. This is show below.
- Split up a Batch XML into Individual XML files.
Eg: Input – Batch XML File
- Split up an XML file that has more than one Embedded XML files into individual Files
Eg: Input – Has two types of XML Files
Output – Two separate xml files
- Create a new BizTalk Server Project and two Schemas – Schema1 & Schema2 as shown below
- Create a new Schema Schema3 and rename the Root Node to Envelope or some thing else
- Scheme and Go to Properties and make Envelope property to Yes
- Now select the Root Node Envelope and Go to Properties. Click on the Ellipses next to Body XPath and Select the Root Node itself. ( Here you are specifying that the Body of the Envelope starts with the Root Node itself)
- Deploy the Application
- Create One File Receive Port and 2 File Send Ports. Use XML Receive pipeline for Receive Port and pass through pipeline for the send ports.
- Since we are not using any orchestrations for receiving/routing the separated individual XML files, we have to set the Filter properties of Both the send ports to Subscribe for the individual XML files as given below.
For Send Port1 – BTS.MessageType == http://BizTalk_Server_Project2.Schema1#Root1
For Send Port2 – BTS.MessageType == http://BizTalk_Server_Project2.Schema2#Root2
Note: Change the Values according to your project, schema and Root Names. It should be in the format TargetNamespace+#+RootName
- Create an Envelope XML file which has Embedded XML files of Schema1 & Schema2
- Drop the above XML in the Receive Folder. Very soon it will be split up into 2 separate XML Files
- These two will be stored in the two folders specified in the Send Ports