Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #357 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Incompatible with Rails: conflict with Array#to_xml from activesupport

Reported by: nahi Assigned to: nahi
Priority: highest Milestone: 1.5.6
Component: soap4r Version: 1.5
Keywords: Cc:

Description

from soap4r-ml

I am working on a Rails app that needs to access an externally
provided web service.  As a result, I would like to use both soap4r
and Rails (ActiveRecord, ActiveSupport, etc.) in a single app.
Unfortunately, both soap4r and activesupport expect certain objects to
respond to to_xml, but each expects different symantics.  The result
is a runtime exception when I try to send a request to my web service.

RuntimeError: Not all elements respond to to_xml
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/core_ext/array/conversions.rb:48:in `to_xml'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/baseData.rb:749:in `to_xml'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/core_ext/array/conversions.rb:66:in `to_xml'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/core_ext/array/conversions.rb:66:in `each'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/core_ext/array/conversions.rb:66:in `to_xml'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/vendor/builder/xmlbase.rb:140:in `call'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/vendor/builder/xmlbase.rb:140:in `_nested_structures'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/vendor/builder/xmlbase.rb:60:in `method_missing'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/vendor/builder/xmlbase.rb:32:in `__send__'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/vendor/builder/xmlbase.rb:32:in `tag!'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/core_ext/array/conversions.rb:66:in `to_xml'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/baseData.rb:749:in `to_xml'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/generator.rb:72:in `encode_data'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/generator.rb:121:in `encode_element'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/element.rb:125:in `encode'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/element.rb:124:in `each'
... 6 levels...
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/generator.rb:75:in `encode_data'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/generator.rb:60:in `generate'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/processor.rb:30:in `marshal'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/rpc/proxy.rb:255:in `marshal'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/rpc/proxy.rb:167:in `route'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/rpc/proxy.rb:142:in `call'
        from /usr/lib/ruby/gems/1.8/gems/soap4r-1.5.5.20070605/lib/
soap/rpc/driver.rb:180:in `call'

When soap4r asks an Array whether it responds (normally it would not),
activesupport's extensions to the array cause it to indicate that it
does.  Array#to_xml expects all its contained objects to also respond
to to_xml.

I understand that this is not strictly a bug in either soap4r or
Rails, but it does prevent me from using both together.  What would
you propose?

Thanks,
Layne Miller

Change History

06/07/07 22:00:29 changed by nahi

  • status changed from new to closed.
  • resolution set to fixed.

(In [1837]) * avoid conflict with ActiveSupport?'s Array#to_xml. renamed to_xml -> to_xmlpart. closes #357.