예제 #1
0
        /// <summary>
        /// Implements IComponent.Execute method.
        /// </summary>
        /// <param name="pc">Pipeline context</param>
        /// <param name="inmsg">Input message</param>
        /// <returns>Original input message</returns>
        /// <remarks>
        /// IComponent.Execute method is used to initiate
        /// the processing of the message in this pipeline component.
        /// </remarks>
        public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(Microsoft.BizTalk.Component.Interop.IPipelineContext pc, Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
        {
            //
            // TODO: implement component logic
            //
            // this way, it's a passthrough pipeline component
            IBaseMessageContext context = inmsg.Context;
            Stream            inStream  = inmsg.BodyPart.Data;
            XslTransmitHelper transmit  = new XslTransmitHelper(this.XslPath, this.XPathSourceFileName, this.EnableValidateNamespace, this.AllowPassThruTransmit);

            if (!string.IsNullOrEmpty(this.XPathSourceFileName))
            {
                string sourceFileName = transmit.GetSourceFileName(XmlReader.Create(inStream), this.XPathSourceFileName);
                if (!string.IsNullOrEmpty(sourceFileName))
                {
                    context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", sourceFileName);
                    context.Promote("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", sourceFileName);
                }
                inStream.Seek(0, SeekOrigin.Begin);
            }
            var outStream = transmit.Transmit(inStream);

            inmsg.BodyPart.Data = outStream;
            pc.ResourceTracker.AddResource(outStream);



            return(inmsg);
        }
예제 #2
0
        static void Main(string[] args)
        {
            var stream = new FileStream(@"C:\Users\Administrator\AppData\Local\Temp\2\_SchemaData\WNCB2B.CALLOFF_output.xml", FileMode.OpenOrCreate);
            var h      = new XslTransmitHelper(@"D:\B2BPlatForm\XSL\WNC\CALLOFF.xsl", "", true, true);

            var stream1 = h.Transmit(stream);

            var buff = new byte[stream1.Length];

            stream1.Read(buff, 0, buff.Length);
            FileStream fs = new FileStream("d:\\ddx.xml", FileMode.Create);

            fs.Write(buff, 0, buff.Length);
            fs.Close();


            GetNamespace();
        }