SOAP, How to add EncodingType attribute in Nonce element?

602 views
Skip to first unread message

Don

unread,
Jul 6, 2012, 10:34:50 AM7/6/12
to sav...@googlegroups.com
Hello,
I need to make a soap call to a web service which requires the EncodingType in the Nonce.
So the correct soap message will have the Nonce element like this:
......
......

But in my Savon client, I don't know how to add that attribute in the Nonce element.
My code here:
......
client = Savon.client do
  wsdl.namespace = "namespace"
  wsse.credentials "username", "password"
  wsse.digest = "true"
end
client.request :get_service do |soap|
  soap.input = [ 
    "GetService", 
    { "xmlns" => "namespace" } 
  ]
  soap.body = {
    "locale" => "en_US",
    "serviceID" => '123'
  } 
end
......

and the Nonce in the generated SOAP message is like:
......
<wsse:Nonce>SomeHashValue</wsse:Nonce>
......
So my question is, how to add the attribute EncodingType to the Nonce element, without changing/removing the SomeHashValue in the Nonce element?
I did some google and couldn't find any answer or solution directly to my problem. 
But I think I have a different case. I really hope I can solve this problem in Savon. Savon is very easy to use and if possible I don't want to use other web service "gem".

Thanks!

Daniel Au

unread,
Feb 3, 2014, 5:37:00 PM2/3/14
to sav...@googlegroups.com
This is an old post, but if you're still interested:

zero...@gmail.com

unread,
Feb 24, 2014, 11:07:59 AM2/24/14
to sav...@googlegroups.com
Hi Don,

Try

I've had success modifying the `gems\akami-1.2.1\lib\akami\wsse.rb` file's `def wsse_username_token` method.

I don't know the best way but this does work, merely add to the `:attributes!`.

Before:

    :attributes! => { "wsse:Password" => { "Type" => PASSWORD_DIGEST_URI } }

After:

    :attributes! => { "wsse:Password" => { "Type" => PASSWORD_DIGEST_URI }, "wsse:Nonce" => { "EncodingType" => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'} }
Reply all
Reply to author
Forward
0 new messages