使用 WSHttpBinding 时检索 WCF 自动设置的 MessageId
我使用 WCF 来使用遵循 WS 表单的 Web 服务(然后使用 WSHttpBinding 绑定)。此表单涉及在肥皂请求标头中设置的 MessageID
以及在响应标头的 RelatesTo
字段中存在的相同 ID。我想记录我发出的请求以及此 MessageId,但找不到检索 WCF 设置的 messageId 的方法,我也可以手动设置它。我设法通过在字段上设置正确的属性来从响应中获取它,但在请求上这样做让我可以设置它,但似乎 WCF 会覆盖它并且不允许我在调用后访问新值事件。
有什么想法吗?
I use WCF to consume a web service that respect the WS form (I then use WSHttpBinding binding). This form involves a MessageID
to be set in the header of the soap request and the same id being present in the reponse header in the RelatesTo
field. I'd like to log the request I made along with this MessageId but can't find a way to retrieve the messageId set by WCF either can I set it manually. I managed to get it from the response by setting the right attribute on the field but doing so on the request let me set it but is seems WCF overrides it and don't let me accessing the new value event after the call has been made.
Any idea ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也没有找到检索自动设置的消息 ID 的方法,但您可以轻松手动设置它:
希望有帮助
I didn't find a way to retrieve the automatically set message ID either, but you can set it manually easily:
Hope that helps