none
How to read the Property Name="GS02" in a xml zombie message RRS feed

  • Question

  • Hi Everyone,

    I am trying to get the value for property Name GS02 in an xml zombie message:

     <Property Name="GS02" Namespace="http://schemas.microsoft.com/Edi/PropertySchema" Value="MCS" />

    I would like to get the GS02 value from xml in order to resubmit the message. I am using some c# WMI code to read the content of the message but I have not found the way to read the GS02 property name yet.

    Is there a way to accomplish that?

    Thanks in advance
    Pablo


    string strWQL = "Select * from MSBTS_MessageInstance where ReferenceType = 8 and ServiceInstanceID = \"" + strInstanceID + "\"";  
     
    ManagementObjectSearcher searcherServiceInstance = new ManagementObjectSearcher(new ManagementScope("root\\MicrosoftBizTalkServer"), new WqlObjectQuery(strWQL), null);  
                    foreach (ManagementObject obj in searcherServiceInstance.Get())  
                    {  
                        obj.InvokeMethod("SaveToFile"new object[] { strOutputPath });  
     
                        // Get the MessageInstanceID  
                        string MessageInstanceID = obj["MessageInstanceID"].ToString();  
     
                        // We now need to load the context file up to get the MessagePart information  
                        fileName = String.Format(@"{0}\{1}_context.xml", strOutputPath, MessageInstanceID);  
     
                        // Load the context file up  
                        XmlDocument doc = new XmlDocument();  
                        doc.Load(fileName);  
     
                        // Use XPath to return all of the MessagePart(s) referenced in the context  
                        // We can then load the file up to get the Message information  
                        XmlNodeList MessageParts = doc.SelectNodes("/MessageInfo/PartInfo/MessagePart");  
     
                        foreach (XmlNode MessagePart in MessageParts)  
                        {  
                            // Pull the MessagePart info out that we need  
                            string MessagePartID = MessagePart.Attributes["ID"].Value;  
                            string MessagePartName = MessagePart.Attributes["Name"].Value;  
     
                            // If we have a MessagePartName we have to append this to the end of the filename  
                            // It's optional so if we don't have it we don't worry about it  
                            if (MessagePartName.Length > 0)  
                            {  
                                string FileName = String.Format(@"{0}\{1}_{2}_{3}.out", strOutputPath, MessageInstanceID, MessagePartID, MessagePartName);  
                                // Do your work  
                            }  
                            else 
                            {  
                                string FileName = String.Format(@"{0}\{1}_{2}.out", strOutputPath, MessageInstanceID, MessagePartID);  
                                // Do your work  
                            }  
     
                        }  
                    } 
    Sunday, December 28, 2008 12:15 AM

Answers

  • First of all, thank you for your fast reply, I really appreciate it;

    I have gotten the GS02 data element from xml zombie message. The code below is part of my module to accomplish that;

    Thank you again;
    Pablo


    string strWQL = "Select * from MSBTS_MessageInstance where ReferenceType = 8 and ServiceInstanceID = \"" + strInstanceID + "\"";  
     
    ManagementObjectSearcher searcherServiceInstance = new ManagementObjectSearcher(new ManagementScope("root\\MicrosoftBizTalkServer"), new WqlObjectQuery(strWQL), null);  
                    foreach (ManagementObject obj in searcherServiceInstance.Get())  
                    {  
                        obj.InvokeMethod("SaveToFile"new object[] { strOutputPath });  
     
                        // Get the MessageInstanceID  
                        string MessageInstanceID = obj["MessageInstanceID"].ToString();  
     
                        // We now need to load the context file up to get the MessagePart information  
                        fileName = String.Format(@"{0}\{1}_context.xml", strOutputPath, MessageInstanceID);  
     
                        // Load the context file up  
                        XmlDocument doc = new XmlDocument();  
                        doc.Load(fileName);  
     
                        // Use XPath to return all of the MessagePart(s) referenced in the context  
                        // We can then load the file up to get the Message information  
                        XmlNodeList MessageParts = doc.SelectNodes("/MessageInfo/PartInfo/MessagePart");  
     
                        if (MessageParts.Count > 0)  
                        {  
                            string MessagePartID   = MessageParts[0].Attributes["ID"].Value;  
                            string MessagePartName = MessageParts[0].Attributes["Name"].Value;  
                            string ContentType     = MessageParts[0].Attributes["ContentType"].Value;  
     
                            if (ContentType.Equals("application/EDI-X12"))  
                            {  
     
                                MessageParts = doc.SelectNodes("/MessageInfo/ContextInfo/Property");  
     
                                foreach (XmlNode MessagePart in MessageParts)  
                                {  
                                    string PropertyName = MessagePart.Attributes["Name"].Value;  
                                      
                                    if (PropertyName.Equals("GS02"))  
                                    {  
                                        senderCd = MessagePart.Attributes["Value"].Value;  
                                        break;  
                                    }  
     
                                }  
                            }  
     
                        }  
     
                          
                    } 
    • Marked as answer by JPablo.Fuentes Monday, December 29, 2008 4:55 PM
    Monday, December 29, 2008 4:54 PM

All replies

  • The easiest way of viewing it is just to open the BizTalk admin console and then look in the Group hub page for the suspended service instances. Then find the zombie and open it up and look at the message properties. There should be a page for the the message body and the context properties. If it is an Xml message you should look at the message body. If the message was read through an EDI pipeline the GS02 property will be promoted into the context so you can look at its value.

    Thanks,
    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Monday, December 29, 2008 2:18 AM
    Moderator
  • Hi,
        In the documentation you can find this. Path is -> Technical refrences-> Developer reference -> WMI class reference -> MSBTS_MessageInstance:Context . This is of type string and you can find GS02 in this string.


    Thanks
    Gyan
    Monday, December 29, 2008 10:30 AM
  • First of all, thank you for your fast reply, I really appreciate it;

    I have gotten the GS02 data element from xml zombie message. The code below is part of my module to accomplish that;

    Thank you again;
    Pablo


    string strWQL = "Select * from MSBTS_MessageInstance where ReferenceType = 8 and ServiceInstanceID = \"" + strInstanceID + "\"";  
     
    ManagementObjectSearcher searcherServiceInstance = new ManagementObjectSearcher(new ManagementScope("root\\MicrosoftBizTalkServer"), new WqlObjectQuery(strWQL), null);  
                    foreach (ManagementObject obj in searcherServiceInstance.Get())  
                    {  
                        obj.InvokeMethod("SaveToFile"new object[] { strOutputPath });  
     
                        // Get the MessageInstanceID  
                        string MessageInstanceID = obj["MessageInstanceID"].ToString();  
     
                        // We now need to load the context file up to get the MessagePart information  
                        fileName = String.Format(@"{0}\{1}_context.xml", strOutputPath, MessageInstanceID);  
     
                        // Load the context file up  
                        XmlDocument doc = new XmlDocument();  
                        doc.Load(fileName);  
     
                        // Use XPath to return all of the MessagePart(s) referenced in the context  
                        // We can then load the file up to get the Message information  
                        XmlNodeList MessageParts = doc.SelectNodes("/MessageInfo/PartInfo/MessagePart");  
     
                        if (MessageParts.Count > 0)  
                        {  
                            string MessagePartID   = MessageParts[0].Attributes["ID"].Value;  
                            string MessagePartName = MessageParts[0].Attributes["Name"].Value;  
                            string ContentType     = MessageParts[0].Attributes["ContentType"].Value;  
     
                            if (ContentType.Equals("application/EDI-X12"))  
                            {  
     
                                MessageParts = doc.SelectNodes("/MessageInfo/ContextInfo/Property");  
     
                                foreach (XmlNode MessagePart in MessageParts)  
                                {  
                                    string PropertyName = MessagePart.Attributes["Name"].Value;  
                                      
                                    if (PropertyName.Equals("GS02"))  
                                    {  
                                        senderCd = MessagePart.Attributes["Value"].Value;  
                                        break;  
                                    }  
     
                                }  
                            }  
     
                        }  
     
                          
                    } 
    • Marked as answer by JPablo.Fuentes Monday, December 29, 2008 4:55 PM
    Monday, December 29, 2008 4:54 PM