Link to home
Start Free TrialLog in
Avatar of jareddraper
jareddraper

asked on

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());
            }
            }
            
ASKER CERTIFIED SOLUTION
Avatar of Tommie Nathaniel Carter, Jr., MBA
Tommie Nathaniel Carter, Jr., MBA
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial