我正在尝试在 .NET 中创建 Web 服务客户端。我添加了服务引用,Visual Studio 创建了以下绑定:
<bindings>
<basicHttpBinding>
<binding name="sample" />
</basicHttpBinding>
</bindings>
但我得到q0:FailedAuthentication.
我发现只有当我设置WSS_TYPE
为PasswordText
.
如何在 .NET/WCF 中设置绑定配置以获得相同的请求?
下面是 SoapUI 请求:
<soapenv:Envelope xmlns:rnl="sample" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-3">
<wsse:Username>username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">XXXX</wsse:Nonce>
<wsu:Created>date</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<rnl:GetLastUpdate/>
</soapenv:Body>
</soapenv:Envelope>