【发布时间】:2013-01-23 10:34:33
【问题描述】:
我必须从 WCF 请求 OperationContext.Current.RequestContext.RequestMessage.ToString() 中选择特定节点
问题是命名空间在请求之间改变前缀:
所以一旦它是:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Body>
</s:Body>
</s:Envelope>
其他时间:
<soapenv:Envelope xmlns:mes="MessageContracts" xmlns:req="RequestMessages" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
如何确保始终正确获取 Body 节点?
【问题讨论】:
-
变化的不是命名空间(
http://schemas.xmlsoap.org/soap/envelope/),而是命名空间前缀(从s到soapenv)。
标签: c# xml wcf namespaces request