使用WCF/.NET Compact Framework的Soap标头中缺少WS-Addressing元素

使用WCF/.NET Compact Framework的Soap标头中缺少WS-Addressing元素,.net,wcf,web-services,wcf-security,windows-mobile-6,.net,Wcf,Web Services,Wcf Security,Windows Mobile 6,我需要在我们的WCF服务中使用WS-Addressing/WS-Security。这些服务由移动设备Windows mobile 6/.NET Compact Frameowk 3.5调用 我几乎所有的东西都在工作,但由于某些原因,MessageID没有包含在我的标题中,并且它被列为一项要求。绑定和客户端已指定Soap12WSAddressing10。我从传输级日志中得到以下信息: <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-en

我需要在我们的WCF服务中使用WS-Addressing/WS-Security。这些服务由移动设备Windows mobile 6/.NET Compact Frameowk 3.5调用

我几乎所有的东西都在工作,但由于某些原因,MessageID没有包含在我的标题中,并且它被列为一项要求。绑定和客户端已指定Soap12WSAddressing10。我从传输级日志中得到以下信息:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <a:Action s:mustUnderstand="1" u:Id="_3">http://tempuri.org/ISyncService/GetSchemaResponse</a:Action>
    <ActivityId CorrelationId="28815cbc-7d07-45ea-9ce6-ce0a68a375f2" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">7a63c3ec-5955-47fd-9af2-45211b839783</ActivityId>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <u:Timestamp u:Id="uuid-4fb4f460-8485-492b-9865-1b4b49c5c187-16">
      <u:Created>2011-10-24T22:09:53.182Z</u:Created>
      <u:Expires>2011-10-24T22:14:53.182Z</u:Expires>
    </u:Timestamp>

有什么建议吗

我不知道这个问题是否已经得到了回答。我假设您希望在响应中添加ws-addressing标头MessageId。您可以实现IDispatchMessageInspector,在beforesendreply函数中,您可以在我使用VB.NET的回复中添加MessageId,但C应该是等效的:

Public Sub BeforeSendReply(ByRef reply As System.ServiceModel.Channels.Message, ByVal correlationState As Object) Implements IDispatchMessageInspector.BeforeSendReply
   reply.Headers.MessageId = New UniqueId(Guid.NewGuid())
End sub
在我的例子中,在使用messageversion Soap11WSAddressing10或Soap12WSAddressing10时,我的响应中缺少MessageId和To标头。我用上面的代码添加了MessageId,但是如果我尝试以相同的方式添加to头,那么当响应到达客户机时,to头永远不会被包括在内