Sco*_*ker 0 wcf ws-security soap soap-client wsse
我正在尝试与我无法控制的Java Web服务进行通信,并且我正在尝试创建一个可以正常工作的绑定.
includeTimestamp="false"属性,我必须使用a <customBinding>. <mtomMessagingEncoding>元素.这是我的<bindings>元素:
<bindings>
<customBinding >
<binding name="MyBindingName" >
<mtomMessageEncoding />
<transactionFlow />
<security authenticationMode="UserNameOverTransport"
includeTimestamp="false">
</security>
</binding>
</customBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
SOAP Web服务要求邮件头采用以下格式:
<soap:Envelope ... >
<soap:Header ... >
<wsse:UsernameToken>
<wsse:Username>doo</wsse:Username>
<wsse:Password Type="wsse:PasswordText">fuss</wsse:Password>
</...>
</...>
</...>
Run Code Online (Sandbox Code Playgroud)
我最接近的是:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1"></a:Action>
<a:MessageID>urn:uuid:a368e205-a14d-4955-bf75-049cdd3a78c0</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">https://blablabla</a:To>
<o:Security s:mustUnderstand="1"
xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<o:UsernameToken u:Id="uuid-0f1e399b-31a8-4e00-a57f-277c21e94879-1">
<o:Username><!-- Removed--></o:Username>
<o:Password><!-- Removed--></o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
Run Code Online (Sandbox Code Playgroud)
我相信我在这里错过了一些琐碎和愚蠢的东西,但对于我的生活,我无法弄清楚它可能是什么.
您还必须配置消息版本,因为默认情况下它使用WS-Addressing:
<bindings>
<customBinding >
<binding name="MyBindingName" >
<mtomMessageEncoding messageVersion="Soap11" /> <!-- or Soap12 -->
<security authenticationMode="UserNameOverTransport"
includeTimestamp="false">
</security>
</binding>
</customBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
TransactionFlow 根本不需要元素.
顺便说一句.您显示的消息不是WS-Security令牌的有效使用,因为它必须位于Security元素内部,因此如果它确实是Java服务所期望的,它不符合WS-Security规范,您将不得不使用自定义消息头.
| 归档时间: |
|
| 查看次数: |
11920 次 |
| 最近记录: |