我正在使用 AfterReceiveRequest() 方法,如下所示
public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext)
{
}
我得到了如下所示的整个消息头( request.ToString()):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<MyHeader xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AppIp xmlns="http://schemas.datacontract.org/2004/07/WcfTest">192.168.1.0</AppIp>
<AppPwd xmlns="http://schemas.datacontract.org/2004/07/WcfTest">UITPass</AppPwd>
<Appid xmlns="http://schemas.datacontract.org/2004/07/WcfTest">UIT</Appid>
<ShibbolethSessionID i:nil="true" xmlns="http://schemas.datacontract.org/2004/07/WcfTest" />
<UCLALogonID i:nil="true" xmlns="http://schemas.datacontract.org/2004/07/WcfTest" />
<UserUID i:nil="true" xmlns="http://schemas.datacontract.org/2004/07/WcfTest" />
</MyHeader>
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://localhost:60729/Service/StudyListService.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IStudyListService/GetStudyListData</Action>
</s:Header>
</s:Envelope>
我想读使用 request.Headers 的节点。我的标题
默认情况下 request.Headers 为To和Action节点提供属性,如下所示:
request.Headers.To
request.Headers.Action
类似地有什么方法可以获取request.Headers.MyHeader吗?
任何想法表示赞赏。