Vde*_*edT 1 c# wcf wshttpbinding wcf-wshttpbinding
我使用WCF来使用一个尊重WS表单的Web服务(然后我使用WSHttpBinding绑定).此表单涉及MessageID要在soap请求的标头中设置,并且RelatesTo字段中的响应标头中存在相同的id .我想记录我与此MessageId一起发出的请求,但无法找到检索WCF设置的messageId的方法,也可以手动设置它.我设法通过设置在球场上正确的属性,但是,要求这样做,让我将它,但是从响应得到它似乎WCF覆盖它,不要让我访问新值事件已经调用了.
任何的想法 ?
小智 5
我没有找到检索自动设置的消息ID的方法,但您可以轻松地手动设置它:
using (new System.ServiceModel.OperationContextScope((System.ServiceModel.IContextChannel)base.Channel))
{
m_lastMessageId = new System.Xml.UniqueId();
System.ServiceModel.OperationContext.Current.OutgoingMessageHeaders.MessageId = m_lastMessageId;
// call here the request
}
Run Code Online (Sandbox Code Playgroud)
希望有所帮助
| 归档时间: |
|
| 查看次数: |
2421 次 |
| 最近记录: |