使用 WCF / .NET Compact Framework 的 Soap 标头中缺少 WS-Addressing 元素
我需要在我们的 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>
有什么建议吗?
I'm required to use WS-Addressing/WS-Security in our WCF services. The services are called by a mobile device, Windows Mobile 6 / .NET Compact Frameowk 3.5.
I have just about everything working, but for some reason MessageID isn't getting included in my header, and it's listed as a requirement. The binding and client have Soap12WSAddressing10 specified. I'm getting this from transport level logging:
<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>
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道这个问题是否已经得到解答。我假设您想在响应中添加 ws 寻址标头
MessageId
。您可以实现一个IDispatchMessageInspector
,并在beforesendreply
函数中您可以在回复中添加一个MessageId
(我使用VB.NET,但C#应该是等效的) ):就我而言,在使用
messageversion Soap11WSAddressing10 或Soap12WSAddressing10
。我设法使用上面的代码添加MessageId
,但是如果我尝试以相同的方式添加To
标头,则To
标头是当响应到达客户端时从未包含在内。I do not know if the question is already answered. I am assuming you want to add the ws addressing header
MessageId
in your response. You could implement anIDispatchMessageInspector
and in thebeforesendreply
function you could add aMessageId
in the reply( I used VB.NET but C# should be equivalent):In my case both the
MessageId
and theTo
-header were missing in my response while usingmessageversion Soap11WSAddressing10 or Soap12WSAddressing10
. I managed to add theMessageId
with the above code, but if I try to add theTo
header in the same way, theTo
header is never included when the response arrives at the client.