来自WebRequest C#的传出WSS授权

时间:2015-06-10 12:12:37

标签: c# authorization soapui credentials wss

我想在不使用SoapUI的情况下使用服务器的请求和响应构建简单的应用程序。我有授权问题,当我向服务器发送请求时,响应是
"<ns2:ErrorMessage>Job error: Request security validation failed.</ns2:ErrorMessage>" 我在SoapUI中的授权是Outgoing WSS:

<wsse:Security 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" soap:mustUnderstand="1">
    <wsse:UsernameToken wsu:Id="UsernameToken-something...">
      <wsse:Username>someone</wsse:Username>
      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">***</wsse:Password>
      <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">something</wsse:Nonce>
      <wsu:Created>2015-02-11T09:39:28.574Z</wsu:Created>
    </wsse:UsernameToken>
  </wsse:Security>

尝试这种方式但不起作用

    System.Net.CredentialCache credentialCache = new System.Net.CredentialCache(); 
    credentialCache.Add(
        new System.Uri("URL"),
        "Basic", 
        new System.Net.NetworkCredential("username","pass") // trying with and without domain
    );
    request.Credentials = credentialCache; 

我如何才能获得此授权?简单的networkCredential不起作用,我不能用AUTH用户名,密码和域写,我必须用Outgoing WSS或idk来做:/

0 个答案:

没有答案