Пример #1
0
        private static void Export(BizTalkTrackedMessage message, bool exportContext)
        {
            ExportMessage(message);

            if (exportContext)
                ExportContext(message);
        }
Пример #2
0
        private static void Export(BizTalkTrackedMessage message, bool exportContext)
        {
            ExportMessage(message);

            if (exportContext)
            {
                ExportContext(message);
            }
        }
Пример #3
0
        private static void ExportMessage(BizTalkTrackedMessage message)
        {
            int partNo = 1;

            foreach (var part in message.Parts)
            {
                Console.Error.WriteLine("Exporting {" + message.MessageId + "} part " + partNo + " of " + message.PartCount);

                using (var fs = File.OpenWrite(GetMessagePartExportFilename(message, part)))
                    part.WriteTo(fs, false);

                partNo++;
            }
        }
Пример #4
0
        /// <summary>
        /// Attempts to produce the same context xml format as the built-in tooling in BizTalk. Note
        /// that it is not complete and highly experimental.
        /// </summary>
        private static void ExportContext(BizTalkTrackedMessage message)
        {
            Console.Error.WriteLine("Exporting {" + message.MessageId + "} context");

            var context = db.LoadTrackedMessageContext(message.MessageId, message.SpoolId);

            using (var writer = new XmlTextWriter(GetMessageContextExportFilename(message), Encoding.UTF8))
            {
                writer.Formatting = Formatting.Indented;

                writer.WriteStartElement("MessageInfo");

                writer.WriteStartElement("ContextInfo");
                writer.WriteAttributeString("PropertiesCount", context.Properties.Count.ToString());

                foreach (var property in context.Properties)
                {
                    var arr = property.Value as Array;
                    if (arr != null)
                    {
                        writer.WriteStartElement("ArrayProperty");
                        writer.WriteAttributeString("Name", property.Name);
                        writer.WriteAttributeString("Namespace", property.Namespace);

                        for (int i = 0; i < arr.Length; i++)
                        {
                            writer.WriteStartElement("ArrayElement" + (i + 1));
                            writer.WriteAttributeString("Value", arr.GetValue(i).ToString());

                            writer.WriteEndElement();
                        }

                        writer.WriteEndElement();
                    }
                    else
                    {
                        writer.WriteStartElement("Property");

                        writer.WriteAttributeString("Name", property.Name);
                        writer.WriteAttributeString("Namespace", property.Namespace);
                        writer.WriteAttributeString("Value", property.Value.ToString());

                        writer.WriteEndElement();
                    }
                }

                writer.WriteEndElement();

                writer.WriteStartElement("PartInfo");
                writer.WriteAttributeString("PartsCount", message.PartCount.ToString());

                foreach (var part in message.Parts)
                {
                    writer.WriteStartElement("MessagePart");

                    writer.WriteAttributeString("ID", "{" + part.PartId + "}");
                    writer.WriteAttributeString("Name", part.PartName);
                    writer.WriteAttributeString("FileName", Path.GetFullPath(GetMessagePartExportFilename(message, part)));

                    writer.WriteAttributeString("Charset", "");
                    writer.WriteAttributeString("ContentType", "");

                    writer.WriteEndElement();
                }

                writer.WriteEndElement();

                writer.WriteEndElement();
            }
        }
Пример #5
0
 private static string GetMessageContextExportFilename(BizTalkTrackedMessage message)
 {
     return("{" + message.MessageId + "}_context.xml");
 }
Пример #6
0
 private static string GetMessagePartExportFilename(BizTalkTrackedMessage message, BizTalkTrackedMessagePart part)
 {
     return("{" + message.MessageId + "}_{" + part.PartId + "}" + (part.PartName == "" ? "" : "_" + part.PartName) + ".out");
 }
Пример #7
0
        /// <summary>
        /// Attempts to produce the same context xml format as the built-in tooling in BizTalk. Note
        /// that it is not complete and highly experimental.
        /// </summary>
        private static void ExportContext(BizTalkTrackedMessage message)
        {
            Console.Error.WriteLine("Exporting {" + message.MessageId + "} context");

            var context = db.LoadTrackedMessageContext(message.MessageId, message.SpoolId);

            using (var writer = new XmlTextWriter(GetMessageContextExportFilename(message), Encoding.UTF8))
            {
                writer.Formatting = Formatting.Indented;

                writer.WriteStartElement("MessageInfo");

                writer.WriteStartElement("ContextInfo");
                writer.WriteAttributeString("PropertiesCount", context.Properties.Count.ToString());

                foreach (var property in context.Properties)
                {
                    var arr = property.Value as Array;
                    if (arr != null)
                    {
                        writer.WriteStartElement("ArrayProperty");
                        writer.WriteAttributeString("Name", property.Name);
                        writer.WriteAttributeString("Namespace", property.Namespace);

                        for (int i = 0; i < arr.Length; i++)
                        {
                            writer.WriteStartElement("ArrayElement" + (i + 1));
                            writer.WriteAttributeString("Value", arr.GetValue(i).ToString());

                            writer.WriteEndElement();
                        }

                        writer.WriteEndElement();
                    }
                    else
                    {
                        writer.WriteStartElement("Property");

                        writer.WriteAttributeString("Name", property.Name);
                        writer.WriteAttributeString("Namespace", property.Namespace);
                        writer.WriteAttributeString("Value", property.Value.ToString());

                        writer.WriteEndElement();
                    }
                }

                writer.WriteEndElement();

                writer.WriteStartElement("PartInfo");
                writer.WriteAttributeString("PartsCount", message.PartCount.ToString());

                foreach (var part in message.Parts)
                {
                    writer.WriteStartElement("MessagePart");

                    writer.WriteAttributeString("ID", "{" + part.PartId + "}");
                    writer.WriteAttributeString("Name", part.PartName);
                    writer.WriteAttributeString("FileName", Path.GetFullPath(GetMessagePartExportFilename(message, part)));

                    writer.WriteAttributeString("Charset", "");
                    writer.WriteAttributeString("ContentType", "");

                    writer.WriteEndElement();
                }

                writer.WriteEndElement();

                writer.WriteEndElement();
            }
        }
Пример #8
0
 private static string GetMessagePartExportFilename(BizTalkTrackedMessage message, BizTalkTrackedMessagePart part)
 {
     return "{" + message.MessageId + "}_{" + part.PartId + "}" + (part.PartName == "" ? "" : "_" + part.PartName) + ".out";
 }
Пример #9
0
 private static string GetMessageContextExportFilename(BizTalkTrackedMessage message)
 {
     return "{" + message.MessageId + "}_context.xml";
 }
Пример #10
0
        private static void ExportMessage(BizTalkTrackedMessage message)
        {
            int partNo = 1;
            foreach (var part in message.Parts)
            {
                Console.Error.WriteLine("Exporting {" + message.MessageId + "} part " + partNo + " of " + message.PartCount);

                using (var fs = File.OpenWrite(GetMessagePartExportFilename(message, part)))
                    part.WriteTo(fs, false);

                partNo++;
            }
        }