Outgoing WSS authorization from WebRequest C#

1.1k views Asked by At

i want to build simple application with request and response from server without using SoapUI. I have problem with authorization, when i send request to server the response is
"<ns2:ErrorMessage>Job error: Request security validation failed.</ns2:ErrorMessage>" My authorization in SoapUI is 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>

Trying this way but doesn't work

    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; 

How i can do this authorization? Simple networkCredential doesn't work, i can't write in AUTH username, password and domain, i must do it with Outgoing WSS or idk :/

0

There are 0 answers