简体   繁体   English

使用C#的Java SOAP服务WSSecurity

[英]C# consuming Java SOAP service WSSecurity

I'm trying to consume a Java-based webservice and everytime I try to connect i get an errror just like that: 我正在尝试使用基于Java的Web服务,每次尝试连接时都会出现如下错误:

org.apache.ws.security.WSSecurityException: The security token could not be authenticated or authorized; org.apache.ws.security.WSSecurityException:无法对安全令牌进行身份验证或授权。

The service administrator said I should sent the password encrypted with an AES key wich he sent me. 服务管理员说,我应该发送用AES密钥加密的密码,直到他发送给我为止。

Thats what i have on my web.config so far 到目前为止,这就是我在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>

The error happens when i try to execute any method on that service. 当我尝试在该服务上执行任何方法时,就会发生错误。 What should I modify to add my key? 我应该修改什么来添加我的密钥? Anyone? 任何人?

Don't use BasicHTTPBinding with hard-coded headers. 不要将BasicHTTPBinding与硬编码的标头一起使用。 Use the built-in WS-Security support in WCF instead. 请改用WCF中的内置WS-Security支持。 See http://msdn.microsoft.com/en-us/library/vstudio/ms731058(v=vs.90).aspx . 请参阅http://msdn.microsoft.com/zh-cn/library/vstudio/ms731058(v=vs.90).aspx Also, take a look at the config that gets generated when you consume the service WSDL. 另外,看看使用服务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