Esempio n. 1
0
        void IDisassemblerComponent.Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
        {
            innerDasm.EnvelopeSpecNames = this.EnvelopeSpecNames;
            //Important not to add the DocumentSpecNames to the inner disassembler as it will not allow messages
            //that we want to ignore, that is not the same as AllowUnrecognizedMessage = true as UnrecognizedMessage
            //means a message without corresponding installed schema
            //This is also why i could not sublass XmlDasmComp
            innerDasm.AllowUnrecognizedMessage         = true;
            innerDasm.ValidateDocument                 = this.ValidateDocument;
            innerDasm.RecoverableInterchangeProcessing = this.RecoverableInterchangeProcessing;

            SchemaList documents = this.DocumentSpecNames;

            foreach (Schema item in documents)
            {
                IDocumentSpec documentSpec = pContext.GetDocumentSpecByName(item.SchemaName);

                string[] messageParts = documentSpec.DocType.Split(new char[] { '#' });

                MessageType msgType = new MessageType
                {
                    RootName = messageParts[1]
                    ,
                    TargetNamespace = messageParts[0]
                };

                if (messageTypes.ContainsKey(msgType) == false)
                {
                    messageTypes.Add(msgType, documentSpec);
                }
            }


            innerDasm.Disassemble(pContext, pInMsg);
        }
        public IBaseMessage GetNext(IPipelineContext pContext)
        {
            if (messages == null)
            {
                messages = new Queue <IBaseMessage>();
                IBaseMessage msgS1 = null;
                while ((msgS1 = ffDasmPC.GetNext(pContext)) != null)
                {
                    XmlDasmComp xmlDasmPC = new XmlDasmComp();
                    SetXmlDasmProperties(xmlDasmPC);
                    xmlDasmPC.Disassemble(pContext, msgS1);
                    IBaseMessage msgS2 = null;
                    while ((msgS2 = xmlDasmPC.GetNext(pContext)) != null)
                    {
                        messages.Enqueue(msgS2);
                    }
                }
            }

            if (messages.Count > 0)
            {
                return(messages.Dequeue());
            }
            return(null);
        }
        /// <summary>
        /// Promotes properties defined in an XSD schema for an XML message.
        /// </summary>
        /// <param name="message">the XML message.</param>
        /// <param name="pc">Pipeline context.</param>
        /// <returns>The message with promoted properties.</returns>
        public static IBaseMessage PromotePropertiesBySchema(this IBaseMessage message, IPipelineContext pc)
        {
            // Write the PromotePropertiesOnly property on the message
            message.Context.Write("PromotePropertiesOnly", Resources.UriXmlNormProperties, true);

            var xmlDasmComp = new XmlDasmComp {
                AllowUnrecognizedMessage = true, ValidateDocument = false
            };

            xmlDasmComp.Disassemble(pc, message);
            var outMsg = xmlDasmComp.GetNext(pc);

            outMsg.BodyPart.Data.Position = 0;
            return(outMsg);
        }
 public void Disassemble(IPipelineContext pContext, Microsoft.BizTalk.Message.Interop.IBaseMessage pInMsg)
 {
     _xmlDissambler.Disassemble(pContext, pInMsg);
 }