?
Solved

How to send/receive XmlDocument objects via a message queue?

Posted on 2005-04-27
3
Medium Priority
?
437 Views
Last Modified: 2010-08-05
The XmlDocument object already includes the messages i want to send in xml format. So i dont need to use the XmlMessageFormatter to serialize the object into xml format? How could i send the XmlDocument object via a message queue? Do I need to serialzie it in another way? Thanks a lot!
0
Comment
Question by:heyday2004
  • 2
3 Comments
 
LVL 7

Expert Comment

by:NipNFriar_Tuck
ID: 13877534
Actually you could send as text like...

XmlDocument doc = your xml Document.
doc.OuterXml

that will give you the complete string representation of the XmlDoc.  Then when you get the string on the other side you can do

string xmlStr = string from MSMQ
XmlDocument doc = new XmlDocument();
doc.LoadXml( xmlStr )


HTH
0
 

Author Comment

by:heyday2004
ID: 13882886
Thanks. Do I need to serialize the class? Isn't it a must that every class sent to the queue must be Serializable? Actually, I really don't quite understand serialization here. Thanks.
0
 
LVL 7

Accepted Solution

by:
NipNFriar_Tuck earned 2000 total points
ID: 13886105
Well if you were trying to send a class then yes... However, you are sending a string.... The doc.OuterXml serializes the XmlDocument into a string with xml tags.  The doc.LoadXml(xmlStr) then puts that string back into an xml document.  Now if you wanted to send a class then you would want to serialize that and the options that you have there are to serialize to a binary string or xml string and either can be sent via MSMQ.  Anyhow this is how I am currently doing this...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question