繁体   English   中英

使用C#的Java SOAP服务WSSecurity

[英]C# consuming Java SOAP service WSSecurity

我正在尝试使用基于Java的Web服务,每次尝试连接时都会出现如下错误:

org.apache.ws.security.WSSecurityException:无法对安全令牌进行身份验证或授权。

服务管理员说,我应该发送用AES密钥加密的密码,直到他发送给我为止。

到目前为止,这就是我在web.config上拥有的内容

<client>
      <endpoint address="http://webservicer2:8088/billing/"
        binding="basicHttpBinding" bindingConfiguration="ServiceBill3"
        contract="ServiceBilling.ServiceBillingContract" name="ServiceBill3">
        <headers>
          <wsse:Security soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
            soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
            <wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
              <wsse:Username>ohmygod</wsse:Username>
              <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">bbqsauce</wsse:Password>
            </wsse:UsernameToken>
          </wsse:Security>
        </headers>
      </endpoint>
    </client>

当我尝试在该服务上执行任何方法时,就会发生错误。 我应该修改什么来添加我的密钥? 任何人?

不要将BasicHTTPBinding与硬编码的标头一起使用。 请改用WCF中的内置WS-Security支持。 请参阅http://msdn.microsoft.com/zh-cn/library/vstudio/ms731058(v=vs.90).aspx 另外,看看使用服务WSDL时生成的配置。

尝试此操作以输入wsse:Password中的密码

http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM