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      \r\n2001078604000107860400063M1000269  100293499         CAP                 CERAMIC CAPACITOR                                                                                                                                               0000010000AM    14-00NO_PORDER      001SNK15217       4200134227        CHN               1SNK15217-KFM      \r\n";
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));
       }
   }

  

你可能感兴趣的:(BizTalk Orchestration execute Flat file disassembler ReceivePipeline)