troubleshooting Question

empty payload xml file websphere MQ .net

Avatar of jareddraper
jareddraper asked on
SoftwareC#ASP.NET
1 Comment1 Solution886 ViewsLast Modified:
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());
            }
            }
            
ASKER CERTIFIED SOLUTION
Tommie Nathaniel Carter, Jr., MBA
Founder

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros