Debatching(Splitting) XML Message in Orchestration using DefaultPipeline - BizTalk 2010

 
In this post we will walk through the process of debatching an xml message in Orchestration using pipeline in Biztalk.

I have used the Default XML Receive pipeline to achieve it, but it can also be done by creating a custom pipeline which uses XML disassembler (where you can set the Envelope and Document Schema).

Pipeline is not available in Orchestration like other shapes, thus to use it we need to add reference to following assemblies(which will allow us to use methods in those assemblies) :

  • Microsoft.XLANGs.Pipeline.dll
  • Microsoft.BizTalk.Pipeline.dll

You can browse to the location BizTalk Installation Directory to find above dll's.

Most of the part of this post is borrowed from my earlier post which talks about debatching xml at receive port:
http://tech-findings.blogspot.in/2013/07/debatchingsplitting-xml-message-biztalk.html

Scenario:

We receive many item information but its wrapped (Enveloped) , so to process each item we need to unwrap it (remove the envelope and split individual Item message).

Below is what we receive (Input) :
<ns0:Items xmlns:ns0="http://TestingSchemas.ItemEnvelope">
  <ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_0</ID> 
  <Name>Name_0</Name> 
  <Quantity>100</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
  <ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_0</ID> 
  <Name>Name_1</Name> 
  <Quantity>200</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
  <ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_2</ID> 
  <Name>Name_2</Name> 
  <Quantity>300</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
<ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_3</ID> 
  <Name>Name_2</Name> 
  <Quantity>300</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
<ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_4</ID> 
  <Name>Name_2</Name> 
  <Quantity>300</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
<ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_5</ID> 
  <Name>Name_2</Name> 
  <Quantity>300</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
<ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_6</ID> 
  <Name>Name_2</Name> 
  <Quantity>300</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
<ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_7</ID> 
  <Name>Name_2</Name> 
  <Quantity>300</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
<ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_8</ID> 
  <Name>Name_2</Name> 
  <Quantity>300</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
<ns1:Product xmlns:ns1="http://TestingSchemas.Item">
  <ID>ID_9</ID> 
  <Name>Name_2</Name> 
  <Quantity>300</Quantity> 
  <UnitPrice>100</UnitPrice> 
  </ns1:Product>
  </ns0:Items>

But we want (Output) :

      <ns0:Product xmlns:ns0="http://TestingSchemas.Item">
           <ID>ID_0</ID>
          <Name>Name_0</Name>
          <Quantity>100</Quantity>
          <UnitPrice>100</UnitPrice>
      </ns0:Product>
             .
             .
             .
             .
             .
 
     <ns0:Product xmlns:ns0="http://TestingSchemas.Item">
        <ID>ID_9</ID>
        <Name>Name_9</Name>
        <Quantity>100</Quantity>
        <UnitPrice>100</UnitPrice>
     </ns0:Product>
 
 
All right, let's see how we do it:
 
1. Create schema - document schema 
 
2. Create the wrapper - Envelope Schema
 
  • Name the root node, I have named it Items.
 
 
 
  • Click on "Schema" and go to Properties Window
  • Set the property "Envelope" as Yes, as this schema will be used as envelope and this is the property which helps disassembler to recognize it.
  • So far good, envelope schema is ready but what about the document which will be wrapped.
  • In the Property window select "Imports" and click on the ellipsis
  • You will get Imports wizard pop-ed  out  .
  • Click on add and select the document schema which we created in step 1.(Here it is Item schema)
 
 
 
  • Click on the "Items" and go to property window and select the property Body XPath and set it to /*[local-name()='Items' and namespace-uri()='http://TestingSchemas.ItemEnvelope']. Doing so allows an Items node to contain any number of Item Document.
  • Cool... Now we are ready with the resources, next is to validate schema, build it, sign it  and deploy.
 
 
 
 
3. Now lets create Orchestration which will receive the enveloped item and debatch/split it using the pipeline.

 
  • Receive shape is configured to receive untyped message i.e. of type System.Xml.XmlDocument (which will receive enveloped message -ItemEnvelope Type) .
  • Then we have a "DebatchScope"  which is of type "Atomic" and Orchestration  is of type Long running. Why Atomic scope? Because we will be calling/executing Pipeline within it and the pipeline is of non- serializable type.
  • Next we have Expression shape named as "Execute Pipeline". It is here where we make call to pipeline  and execute it which results in splitted messages.
  • It contains following line:  GetPipelineOutput=Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(Microsoft.BizTalk.DefaultPipelines.XMLReceive),ItemsIn);
  • GetPipelineOutput is a DebatchScope variable of type: Microsoft.XLANGS.Pipeline.ReceivePipelineOutputMessages
  • So we are executing the method ExecuteReceivePipeline()  method of XLANGPipelineManager class  which belongs to Microsoft.XLANGs.Pipeline and its output assigned to  GetPipelineOutput.
 

 
  • Then we have a loop shape "UntilLastMessage" and its same as  while loop, below is the condition(tillspillited messages are available) : GetPipelineOutput.MoveNext()
  • Next is Construct shape with Message Assignment within it, which has following code:
 ItemOut = null;
          GetPipelineOutput.GetCurrent(ItemOut);
 
It is here where the splitted single  message is assigned to ItemOut , where ItemOut is a Message variable which is of type Item.xsd
  • At last we have Send shape which accepts message of type ItemOut and sends it .
  • Now what, build the project , sign it and deploy .
4.Now create a Receive and Send port :

  • Receive Pipeline is PassThruReceive  as we don't want its message type to be detected until the message reaches to ExecutePipeline shape in Orchestration.

  • Now after both the ports are ready, it's time to bind it to the logical ports of our orchestration:
 
5. Start the application and test it, I will drop a envelope message at receive location which we saw at start  . So I should be getting 10 individual xml message at the destination location:

 
 
 
 
 
        Will keep on posting as an when I find something to share!!!!!!!!!!!!

Debatching(Splitting) XML Message in Orchestration using DefaultPipeline - BizTalk 2010的更多相关文章

  1. Unable to perform unmarshalling at line number 16 and column 63 in RESOURCE hibernate.cfg.xml. Message: cvc-elt.1: 找不到元素 'hibernate-configuration' 的声明。

    七月 02, 2017 4:32:37 下午 org.hibernate.Version logVersionINFO: HHH000412: Hibernate Core {5.2.10.Final ...

  2. BizTalk开发小技巧

    BizTalk开发小技巧 随笔分类 - Biztalk Biztalk 使用BizTalk实现RosettaNet B2B So Easy 摘要: 使用BizTalk实现RosettaNet B2B ...

  3. [Java Basics3] XML, Unit testing

    What's the difference between DOM and SAX? DOM creates tree-like representation of the XML document ...

  4. PHP 开发 APP 接口 学习笔记与总结 - XML 方式封装通信接口

    1.PHP 生成 XML 数据 ① 拼接字符串 ② 使用系统类(DomDocument,XMLWriter,SimpleXML) 例1 使用 PHP 系统类中的 DomDocument 类: < ...

  5. XMl的解析简单的方法

    首先需要jia包 xstream-1.4.7.jar Vo类 package com.zld.day06_03zk3demo.bean; import java.io.Serializable; im ...

  6. xml解析(4)

    本节要点: DOM解析方式 SAX解析方式 DOM4J对XML的解析 XML用于将数据组织起来,形成文档用于存储和传输: 更多时候我们需要的是将xml中的数据解析出来,甚至是在程序中动态生成xml. ...

  7. php生成xml数据

    1.php生成xml数据一般有2种方式, 一个是组装字符串,另一个就是使用php内置的系统类 2.使用php内置类生成xml数据 3.拼装字符串生成xml数据 public function stat ...

  8. Play XML Entities

    链接:https://pentesterlab.com/exercises/play_xxe/course Introduction This course details the exploitat ...

  9. Modifying namespace in XML document programmatically

    Modifying namespace in XML document programmatically static XElement stripNS(XElement root) { return ...

随机推荐

  1. Python3基础知识之数据结构List和Tuple

    问题:今天学习python数据结构中的List和Tuple. 目标:了解二者的区别,学会一般的应用 相关知识:列表(List) : 类似于 .NET ArrayList / List.元组(Tuple ...

  2. eclipse里maven项目An error occurred while filtering resources解决办法

    在使用eclipse构建maven项目时,突然出现错误提示:An error occurred while filtering resources,在项目中到处都找不到哪里有问题,最后在国外网站找到解 ...

  3. ios 单例的再次理解

    单例模式    在建模的时候,如果这个东西确实只需要一个对象,多余的对象都是无意义的,那么就考虑用单例模式.比如定位管理(CLLocationManager),硬件设备就只有一  个,弄再多的逻辑对象 ...

  4. 嵌入式FIFO核的调用

    本次设计源码下载地址:http://download.csdn.net/detail/noticeable/9915523 课程目标:学习调用quartus II 软件的FIFO(先进先出)IP核,并 ...

  5. 分支结构-Switch

    /* switch(表达式或变量){ case value1:{ 语句体1; break; } case value2:{ 语句体2; break; } ... default:{ 语句体n+1; b ...

  6. 如何修改config?

    这几天在做给WCF做加密传输,结果当然是实现了加密传输,同时也发现了一个问题,有没有大神来答疑解惑一下. 事情是这样的. 在客户端的配置中,需要加入一个behavior,在config文件中是这样的. ...

  7. three.js 一幅图片多个精灵

    https://blog.csdn.net/zhulx_sz/article/details/79105359 核心代码 // 把一幅外部图片中包含的5种精灵存入一个精灵材质数组 var sprite ...

  8. 第七节:详细讲解Java中的日期,java.util.date

    前言 大家好,给大家带来详细讲解Java中的日期,java.util.date的概述,希望你们喜欢 类Date Java.lang.Object->java.util.Date public c ...

  9. Shell-11--for

    $(cat /etc/passwd) `cat /etc/passwd`

  10. 使用Qt开发绘制多个设备的流量曲线图(附带项目图)

    一.说明: 在实际项目中,主要是使用Qt开发CS程序,当然主要是客户端.公司项目中有这个需求是实时显示多个设备的流量曲线图,设备将流量信息发给服务端,服务端再将信息通过Socket发给Qt客户端,Qt ...