• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 825
  • Last Modified:

empty payload xml file websphere MQ .net

So I finally get MQ writing to a queue with .net and the payload / message is empty.

I am having a hard time figureing out what I need to add at this point


msgData.ReadBytes(xmlDoc.ReadNode);

I grab this from an xml.element in .net

with the following


System.Xml.XmlElement xe = payload.content[0].Any;
            XmlDocument xmlDoc = xe.OwnerDocument;


I have tried strings and other such things. it just puts a blank message on MQ

here is my code

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/wsTransport/service/ProcessMessage", RequestNamespace="http://www.starstandards.org/webservices/2005/10/transport", ResponseNamespace="http://www.starstandards.org/webservices/2005/10/transport", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Binding="starTransport")]
            public virtual void ProcessMessage([System.Xml.Serialization.XmlElementAttribute(ElementName="payload")] ref Payload payload)
            {
                   //Here is the Code that reads the XML Payload Stream and Validates it to the correct Schema before sending the message forward.

            //System.Xml.XmlElement xe = payload.content[0].Any;
            //XmlDocument xmlDoc = xe.OwnerDocument;
            //xmlDoc.Schemas.Add(null, "http://localhost/wsTransport/ProcessCRM.xsd");
            //xmlDoc.Validate(delegate(object sender, ValidationEventArgs vargs)
            //{
            //    Console.WriteLine("{0}: {1}", vargs.Severity, vargs.Message);
            //}, xe);

            System.Xml.XmlElement xe = payload.content[0].Any;
            XmlDocument xmlDoc = xe.OwnerDocument;
           


            string qManager = "ARKDEV.QUEUE.MANAGER";
            string channel = "SYSTEM.ADMIN.SVRCONN";
            string hostName = "arkdev.arkona.com";
            string qName = "ROB.IN.QUEUE";
           

           
            MQEnvironment.Hostname = (hostName);
            MQEnvironment.Channel = (channel);
            MQEnvironment.Port = 1414;



            try
            {
                MQQueueManager qMgr = new MQQueueManager(qManager);

                MQQueue queue = qMgr.AccessQueue(qName, MQC.MQOO_OUTPUT);

                MQMessage msgData = new MQMessage();

                msgData.ReadBytes(xmlDoc.ReadNode);

                MQPutMessageOptions pmo = new MQPutMessageOptions();

                queue.Put(msgData, pmo);

                queue.Close();

                qMgr.Close();
            }
            catch (MQException e)
            {
                Console.WriteLine("Error: {0}", e.ToString());
            }
            }
            
0
jareddraper
Asked:
jareddraper
1 Solution
 
Tommie Nathaniel Carter, Jr., MBACommented:
Here is a classic example that may help you to resolve this... Filter it by language to show C# and let me know if it doesn't provide sufficient help.

http://msdn2.microsoft.com/en-us/library/system.messaging.message.aspx

More learning, more fun
Tommie
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now