XMLDocument and MSMQ


G

Guest

I have several programs (.net and other) that use the framework to insert
objects into the message queue. The object of choice is the XMLDocument.
There is no problem inserting the XMLDocument into the message queue, however
i can not seem to get the XMLDocument back out of the queue. How do i
De-Serialize the XMLDocument from the message body? Is there a better way?
It has to be a XMLDocument going in, but if i can get out a string or
anything and load it back to a XMLDocument that will work to.

Thanks

Eric
 
Ad

Advertisements

B

Brendan Green

See: MessageQueue.Formatter.

To de-serialise messages off the queue for a program that I wrote for a
client, we did something like this:

// Declare and setup the message queue
// Set formatter
messageQueue.Formatter = new System.Messaging.XmlMessageFormatter(new Type[]
{typeof(string)});

// Get a message off the queue (myMessage is System.Messaging.Message)
myMessage = messageQueue.Receive(new TimeSpan(0, 0, m_timeout),
messageQueueTran);

// Get the body of the message
string msg = (string)myMessage.Body;

In the end, our "msg" contained XML that was then parsed and passed into
another system, but it sounds like this is what you are attempting to do.

Hopefully this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

XmlDocument 4
XMLDocument problems 0
MSMQ Permissions 3
MSMQ group? 2
MSMQ & Multithreading 5
MSMQ and Transactions 1
Working with MSMQ 5
MSMQ Trigger 3

Top