tags:

views:

424

answers:

1

I have an MSMQ that receives XML format messages from various sources. I have a WCF endpoint (using MsmqIntegrationBinding) that I want to receive these messages. I defined the following:

[ServiceContract(Namespace = "http://TestApp.MSMQService", ProtectionLevel = ProtectionLevel.None)]
[ServiceKnownType(typeof(String))]
public interface IMsmqReceiverService
{
    [OperationContract(IsOneWay = true, Action = "*")]
    void SubmitQueueMessage(MsmqMessage<String> msg);
}

Hoping that would receive any XML message, however it only receives messages formated:

<?xml version="1.0">
<string>message</string>

For various reasons we don't know, and don't want to know, the schema of the xml message, getting it into a String would be sufficient. How can I define an endpoint that recieves XML messages with any nodes that arrive on the queue regardless of the schema used in the message?

Additionally, given a String buffer containing the XML of a message, how can I put that onto a MSMQ using System.Messaging.MessageQueue.Send without it getting wrapped in additional xml?

+1  A: 

I haven't used the MSMQ integration, but try MsmqMessage<XmlElement>.

Don't manipulate XML as a string if you can possibly help it. Always use one of the many XML APIs.

John Saunders
Thanks John, that seems to have gotten it.I don't want to manipulate the XML, don't even want to know the schema, I just need to pull it off the queue and send it on, hence why I thought I could get it as a string and avoid deserializing it.This should ho the job though. Thanks again!
Nick Thomson