I have a XML Document which i want to send and receive to a MSMQ queue. I am successfully able to Send the XML Document as a Body, but i am not able to retrieve the message even if I set the Formatter as XML Fomatter. Below is the code snippet.
string queuePath = "FormatName:Direct=TCP:154.154.140231.\\PRIVATE$\\questions";
MessageQueue queue = new MessageQueue(queuePath);
XmlDocument xmlDoc = new XmlDocument();
I haven't actually tried this out, but I believe that you are misconfiguring the XmlMessageFormatter. You are sending as an argument typeof(String), meaning that you expect to retrieve a String encoded inside the XML message body. But in the "sending" part,
you are setting the Body to be an XmlDocument, meaning that you are encapsulating an XmlDocument (instead of a String) inside the XML Body.
You can change the line msg.Body=xmlDoc; to msg.Body=xmlDoc.InnerXml; this will convert the contents of the cmlDoc into a String, which should then be read by the RcXML.Load instruction that you have after receiving the message.