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.R eadNode);
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.Proto cols.SoapD ocumentMet hodAttribu te("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.De scription. SoapBindin gUse.Liter al, ParameterStyle=System.Web. Services.P rotocols.S oapParamet erStyle.Wr apped, Binding="starTransport")]
public virtual void ProcessMessage([System.Xml .Serializa tion.XmlEl ementAttri bute(Eleme ntName="pa yload")] 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.R eadNode);
MQPutMessageOptions pmo = new MQPutMessageOptions();
queue.Put(msgData, pmo);
queue.Close();
qMgr.Close();
}
catch (MQException e)
{
Console.WriteLine("Error: {0}", e.ToString());
}
}
I am having a hard time figureing out what I need to add at this point
msgData.ReadBytes(xmlDoc.R
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.Proto
public virtual void ProcessMessage([System.Xml
{
//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,
//xmlDoc.Validate(delegate
//{
// 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.R
MQPutMessageOptions pmo = new MQPutMessageOptions();
queue.Put(msgData, pmo);
queue.Close();
qMgr.Close();
}
catch (MQException e)
{
Console.WriteLine("Error: {0}", e.ToString());
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.