SoapOutputFilter Customization

Here is a DotNet webservice generated SOAP XML which calls a third-party Java webservice. As per the Server side (Java webservice) requirement I need to filter the Security->UsernameToken element so that I need to pass only the Username and Password. I am trying to remove the parameters Nonce and Created from the UsernameToken.

Here is the DotNet code I use to generate the UsernameToken
token = new UsernameToken( _sUserName, _sPassword, PasswordOption.SendPlainText );
ws.RequestSoapContext.Security.Tokens.Add( token );

This is what the SOAP call generated to be sent out to the third party Webservice.

<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">
<wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" wsu:Id="SecurityToken-80856dec-8fc7-4f00-94ab-5faf62c99dc5">
<wsse:Username>#########</wsse:Username>
<wsse:Password Type="wsse:PasswordText">#########</wsse:Password>
<wsse:Nonce>2Fh63mRKg/oGhwLDNgB70g==</wsse:Nonce>
<wsu:Created>2006-05-19T17:46:20Z</wsu:Created>

</wsse:UsernameToken>
</wsse:Security>

This is how I wanted to be generated.

<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">
<wsse:UsernameToken xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility" wsu:Id="SecurityToken-80856dec-8fc7-4f00-94ab-5faf62c99dc5">
<wsse:Username>#########</wsse:Username>
<wsse:Password Type="wsse:PasswordText">#########</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>

Could some one help me how to do this(remove Nonce and Created parameter) in DotNet Thanks.




Answer this question

SoapOutputFilter Customization

  • Hemant Kumar

    No. I convinced the client to accept the SOAP call with NONCE.

    Still looking for the answer for the future use.


  • LucasB

    Joe, did you figure if this is possible. I have to hit a Java web-service and they are asking me to leave out the Nonce.

    Erik


  • SoapOutputFilter Customization