我有一个 MSMQ,可以接收来自各个来源的 XML 格式消息。我想要使用 MsmqIntegrationBinding 的 WCF 端点来接收这些消息。我定义了以下内容:
[ServiceContract(Namespace = "http://TestApp.MSMQService", ProtectionLevel = ProtectionLevel.None)]
[ServiceKnownType(typeof(String))]
public interface IMsmqReceiverService
{
[OperationContract(IsOneWay = true, Action = "*")]
void SubmitQueueMessage(MsmqMessage<String> msg);
}
希望能够接收任何XML消息,但它只能接收格式化的消息:
<?xml version="1.0">
<string>message</string>
由于各种未知原因,我们不知道也不想知道XML消息的模式,将其转换为字符串即可。如何定义端点以接收XML消息并处理到达队列上的任何节点,而不管消息中使用的模式是什么?
此外,如果有一个包含消息XML的String缓冲区,如何使用System.Messaging.MessageQueue.Send将其放入MSMQ而不会被额外的XML包装?