• 使用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;
            }
        }
    }
    
    






  • 相关阅读:
    L317 电子烟
    L316 波音737Max 危机
    2.19.3月 专业综合错题
    L314 单音节词读音规则(二)-元音字母发音规则
    L313 珊瑚裸鼠灭绝
    L312 难看懂的
    Pycharm写代码中文输入法不跟随
    Windows下Python多版本共存
    Python之批处理字符串(打开文件)
    Python Url请求代码
  • 原文地址:https://www.cnblogs.com/hainange/p/6153576.html
Copyright © 2020-2023  润新知