使用BizTalk解析Web service返回的XMLDocument消息

在系统集成过程中,有些系统发布出来的web service会将对象封装成XMLDocument并以字符串形式输出,当使用BizTalk与其他系统交互时,需要在BizTalk一端对XMLDocument格式的消息进行解析或拆分,我们可以采用循环的方式遍历这个XMLDocument消息来实现,也可以在web service一端取消将消息对象封装为XML的步骤,取而代之的是直接返回一个对象,在BizTalk这一端来对该对象进行解析。

在BizTalk中,通过对XMLDocument消息的循环,可以有效地将XML中的schema拆分出来,并将其中的某些字段映射到其他系统或数据库中。

首先我们要创建一个dll的类,来实现对XMLDocument的解析过程

using System; using System.Collections.Generic; using System.Text; using System.Xml; using System.IO; namespace BizTalkLoopTest { public class Class1 { public static int getLength(XmlDocument xd) { return xd.ChildNodes[0].ChildNodes.Count; } public static XmlDocument getInfo(XmlDocument xd,int index) { XmlDocument xdResult = new XmlDocument(); xdResult.InnerXml = "<ns0:Root xmlns:ns0=\"http://BizTalkLoopProject.Schema1\"><info>" + xd.ChildNodes[0].ChildNodes[index].InnerXml + "</info></ns0:Root>"; return xdResult; } } }





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值