Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Apparent use of outdated savon API in service.rb #15

Open
sidoh opened this issue Jun 23, 2015 · 0 comments
Open

Apparent use of outdated savon API in service.rb #15

sidoh opened this issue Jun 23, 2015 · 0 comments

Comments

@sidoh
Copy link

sidoh commented Jun 23, 2015

I'm using the same code I linked in the other issue (#14).

I may be missing something, but it seems that ~L278 of service.rb is using an outdated savon API. I get this stacktrace:

/home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/playful-0.1.0.alpha.1/lib/playful/control_point/service.rb:286:in `block (2 levels) in define_method_from_action': undefined method `message_tags' for #<Savon::LocalOptions:0x0000000213c598> (NoMethodError)
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/savon-2.0.0/lib/savon/block_interface.rb:10:in `call'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/savon-2.0.0/lib/savon/block_interface.rb:10:in `evaluate'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/savon-2.0.0/lib/savon/operation.rb:41:in `call'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/savon-2.0.0/lib/savon/client.rb:36:in `call'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/playful-0.1.0.alpha.1/lib/playful/control_point/service.rb:285:in `block in define_method_from_action'
    from /home/cmullins/code/me/echo/playground/control_point_test.rb:19:in `block (2 levels) in <top (required)>'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/em/deferrable.rb:151:in `call'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/em/deferrable.rb:151:in `set_deferred_status'
    from /home/cmullins/code/me/echo/playground/control_point_test.rb:46:in `block (3 levels) in <top (required)>'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/em/deferrable.rb:151:in `call'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/em/deferrable.rb:151:in `set_deferred_status'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/playful-0.1.0.alpha.1/lib/playful/control_point/device.rb:176:in `block in fetch'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/em/tick_loop.rb:55:in `call'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/em/tick_loop.rb:55:in `stop'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/em/tick_loop.rb:77:in `block in schedule'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/eventmachine.rb:968:in `call'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/eventmachine.rb:968:in `block in run_deferred_callbacks'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/eventmachine.rb:965:in `times'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/eventmachine.rb:965:in `run_deferred_callbacks'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run_machine'
    from /home/cmullins/.rvm/gems/ruby-2.0.0-rc1/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run'
    from /home/cmullins/code/me/echo/playground/control_point_test.rb:4:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

I tried downgrading the version of savon to no avail. Both 2.7.0 and 2.0.0 appear to have the same issue.

Switching the referenced playful code to use this:

              response = @soap_client.call(action_name.to_s,
                                           {soap_action: "#{st}##{action_name}",
                                            attributes: {'xmlns:u' => st}}) do
                message(params) unless params.nil?
              end

instead of:

            response = @soap_client.call(action_name.to_s) do |locals|
              locals.message_tags 'xmlns:u' => @service_type
              locals.soap_action "#{st}##{action_name}"
              #soap.namespaces["s:encodingStyle"] = "http://schemas.xmlsoap.org/soap/encoding/"

              unless params.nil?
                raise ArgumentError,
                  'Method only accepts Hashes' unless params.is_a? Hash
                soap.body = params.symbolize_keys!
              end
            end

seems to fix the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant