Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot set SOAP header parameters on savon call

I'm using savon 2.2 for making SOAP calls.

Initialize:

  client = Savon.client(
  wsdl: SOAP_WSDL,
  endpoint: SOAP_URL)

I can make a SOAP call like this and it works fine:

resp =  client.call(:login, message: { username: SOAP_USER, password: SOAP_PASSWORD })

Now I need to make another call which requires setting some parameters in the SOAP header. From the documentation on savorb.com I found I should use the request method:

 response = client.request :get_user_info do
    soap.header = { :session_id => sid }
 end 

But I'm getting an error saying that the request method does not exist:

undefined method `request' for #<Savon::Client:0x007f1560f80490>

Do I have a different version of savon or what?? I tried using "call" instead of "request" but then I'm getting:

ArgumentError - wrong number of arguments (1 for 2):
gem) savon-2.2.0/lib/savon/options.rb:35:in `method_missing'
(gem) savon-2.2.0/lib/savon/block_interface.rb:20:in `method_missing'
app/models/tool.rb:23:in `block in doUpload'
like image 449
Ya. Avatar asked Aug 27 '13 12:08

Ya.


Video Answer


1 Answers

You're on Savon 2.2.0. You should use

response = client.call(:get_user_info, :soap_header => { :session_id => sid })

'request' is a method from version 1.x and not supported anymore.

like image 79
Steffen Roller Avatar answered Sep 20 '22 06:09

Steffen Roller