如何使用WS安全性UsernameToken配置自定义绑定?

问题描述

我需要配置一个自定义绑定,使我拥有一个头UsernameToken和wsse签名,如下所示。

<soapenv:Header>
   <wsse:Security>
     <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">...
     <wsse:UsernameToken wsu:Id="UsernameToken-DCF9C511">...
     <wsu:Timestamp wsu:Id="TS-DCF9C5119CC59E9AE2159888852210410">...
   </wsse:Security>
</soapenv:Header>

我尝试使用此配置:

            <bindings>
              <customBinding>
                <binding name="RecaudoWSPortSoap11">
                  <security authenticationMode="CertificateOverTransport"/>
                  <textMessageEncoding messageVersion="Soap11" />
                  <httpsTransport requireClientCertificate="true" />
                </binding>
              </customBinding>
            </bindings>
          <client>
            <endpoint address="https:myservice.com/RecaudoWS/soapws"
              binding="customBinding" bindingConfiguration="RecaudoWSPortSoap11"
              contract="ServicioLLanoGas.RecaudoWSPort" name="RecaudoWSPortSoap11" >
              <headers>
                <wsse:UsernameToken id="UsernameToken-49" xmlns:wsse='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' >
                  <wsse:Username>830131</wsse:Username>
                  <wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>
                    Rcb57*t
                  </wsse:Password>
                </wsse:UsernameToken>            
              </headers>
            </endpoint>
          </client>

通过此配置,我可以在标头中找到“签名”标签,但“ UsernameToken”不存在。

如果我使用安全模式=“ TransportWithMessageCredential”,则可以正确使用“ usernameToken”标签,但是会丢失“ signature”标签。

请帮助我。 非常感谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...