zoukankan      html  css  js  c++  java
  • BizTalk Orchestration execute Flat file disassembler ReceivePipeline

    需求是这样,在一个inbound XML中有个一点节点使用平文件的方式存放,还要解析比如固定长度或根据特殊字符截取字段

    也就是需要在流程里面先把输入的XML的节点先读出来,这个方式有很多可以直接升级属性,或调用Xpath来获取,在流程里面调用执行receivepipeline的方法也非常简单。

    fstr="1001078604000107860400060M1000269  100287128         CONN                ((PLT)) CONNECTOR                                                                                                                                               0000002500AM    14-00NO_PORDER      001SNK15167       6301519046        CN                1SNK15167-KFM      
    2001078604000107860400063M1000269  100293499         CAP                 CERAMIC CAPACITOR                                                                                                                                               0000010000AM    14-00NO_PORDER      001SNK15217       4200134227        CHN               1SNK15217-KFM      
    ";
    doc=new System.Xml.XmlDocument();
    msgcrt.CreateMyMessage(doc,fstr);
    
    
    vpipline = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline
    (typeof(BizTalkPipline.ReceiveFlilePipeline), doc );
    Message_2 =null; //初始化输出消息。
    vpipline .MoveNext(); //IElement的默认方法。
    vpipline .GetCurrent(Message_2 );
    

      

      难的是怎么把string Convert XLangMessage。找了我好久

    [Serializable]
       public class StringStreamFactory : Microsoft.XLANGs.BaseTypes.IStreamFactory
       {
           private string m_mystringdata;
    
           public StringStreamFactory(string stringdata)
           {
               m_mystringdata = stringdata;
           }
    
    
           public System.IO.Stream CreateStream()
           {
               return new System.IO.MemoryStream(System.Text.UTF8Encoding.UTF8.GetBytes(m_mystringdata));
           }
       }
    
       [Serializable]
       public class StringMessageCreator
       {
           public void CreateMyMessage(Microsoft.XLANGs.BaseTypes.XLANGMessage mydestmsg,string content)
           {
               mydestmsg[0].LoadFrom(new StringStreamFactory(content));
           }
       }
    

      

  • 相关阅读:
    模拟赛2020.9.11
    棋盘(dfs)
    树的重心
    模拟赛9.4
    最大数(线段树)
    [模板] 线段树
    [模板][数据结构] 树状数组
    [AHOI2018初中组][二分查找] 分组
    [模板] Kruskal 求最小生成树
    [模板] 最近公共祖先(LCA)的几种求法
  • 原文地址:https://www.cnblogs.com/neozhu/p/4709049.html
Copyright © 2011-2022 走看看