【发布时间】:2009-08-13 14:11:53
【问题描述】:
我有一个从各种来源接收 XML 格式消息的 MSMQ。我有一个想要接收这些消息的 WCF 端点(使用 MsmqIntegrationBinding)。我定义了以下内容:
[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 消息的架构,将其放入 String 就足够了。无论消息中使用的架构如何,如何定义一个接收 XML 消息的端点,其中包含到达队列的任何节点?
此外,给定一个包含消息 XML 的字符串缓冲区,我如何使用 System.Messaging.MessageQueue.Send 将它放到 MSMQ 上而不将其包装在额外的 xml 中?
【问题讨论】: