Search code examples
rubyweb-serviceswsdlsavon

Ruby - Savon - Connecting to web service - 'new' : wrong number of arguments


I'm using Savon to connect to a web service via WSDL I'm getting the error shown below for all attempts to connect using this library. The frustrating thing is that I had code that I've been using to test for several weeks and it hasn't had an issue until today. I'm completely baffled by this. I wrote a new script using nothing but Savon to connect to the service and I get the same error.

I'm getting this error: *test_ConnectToWSDL.rb:4:in new': wrong number of arguments (1 for 0) (ArgumentE rror) from test_ConnectToWSDL.rb:4:in'*

I've checked and double check this code and according to the Savon docs this should be completely valid.

My code

require 'savon'

client = Savon::Client.new "http://myservices.com/service.svc?WSDL"

client.lookup_by_sku do |soap|
  soap.body = {
    :includeStuff => includeStuff,
    :includeStuff2 => includeStuff2,
    :searchStuff => [
        {:"V1" => V1,
          "V2" => V2,
          "V3" => V3,
          "V4" => V4,
          "V5" => V5,
          }
        ]
    }.to_xml
end

Solution

  • So here's what happened. I installed Savon::Spec and it updated my Savon gem to the 0.8 beta3 version which for some reason doesn't like the argument passed for 'new'. If I found out a fix for this or why this code doesn't like the beta gem I'll post again to save someone else 4 hours of their companies money. :)