我們開發了一個WCF4服務,該服務使用由Java/Axis客戶端(我們無法控制)使用的usernameToken身份驗證。WCF響應中的MustUnderstand屬性導致Java/Axis客戶端錯誤
我可以看到該請求的身體看起來像這樣來了...
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wss:Security xmlns:wss="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wss:UsernameToken>
<wss:Username>username</wss:Username>
<wss:Password>password</wss:Password>
</wss:UsernameToken>
</wss:Security>
</soapenv:Header>
<soapenv:Body>
{snipped}
</soapenv:Body>
</soapenv:Envelope>
,我們正在返回看起來像這樣的反應...
<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:Header>
<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="_0">
<u:Created>2012-05-02T01:23:12.711Z</u:Created>
<u:Expires>2012-05-02T01:28:12.711Z</u:Expires>
</u:Timestamp>
</o:Security>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
{snipped}
</s:Body>
</s:Envelope>
的問題是響應中的s:mustUnderstand =「1」屬性。這導致Java/Axis客戶端中的「必須瞭解檢查失敗」錯誤。
有誰知道如何配置WCF刪除此s:mustUnderstand屬性或至少將其設置爲「0」而不是「1」?
這是否幫助? http://stackoverflow.com/questions/3551738/how-to-modify-a-wcf-message-headers-mustunderstand-using-clientinspector – Chris
你的安全配置是什麼?也許從配置中刪除時間戳可以解決問題。否則,你將不得不實現自定義消息編碼器來修改頭。 –