0
votes

I've inherited some Ruby on Rails code and am trying to get it up and running locally. I've seen it work on other people's machines but for me it is throwing an exception. The exception is Savon::UnknownOptionError in DevicesController#index.

What is causing the exception is "Unknown global option: :document=".

Specifically it is failing at row 2 of this call:

wsdl_url = "valid url"
@client = Savon::Client.new do |wsdl|
  wsdl.document = wsdl_url
end
1

1 Answers

1
votes

it seems the code was written for Savon 1.x The current version is 2.2.0 You could explicitely require the old version with

gem 'savon', '=1.2.0'
wsdl_url = 'http://www.example.com?wsdl'
@client = Savon::Client.new do
    wsdl.document = wsdl_url
end

response = @client.request :wsdl, :your_method
print response.to_hash

What I would recommend though is to change the code so it will run with the current version. At http://savonrb.com/version2.html you'll find comprehensive documentation and examples.