Topic: soap4r + ruby 1.9.2 = "XML processor module not found"

Hi all,
  I've learned a lot by just reading this forum and I thank you all for the information. Now I have to post a question for a problem I've just had after installing ruby 1.9.2. I upgraded to ruby 1.9.2 and then installed the soap4r gem. My application had previously been working fine using soap4r with rails 1.8.6 but this upgrade is causing the following problem.

  When I try to use the soap4r classes I get the message "XML processor module not found". I tracked this down to the fact the the soap4r files (xmlparser.rb in the stack trace) are not able to find other soap4r classes they are trying to load. They aren't finding them even though they are all in the same lib directory of the soap4r gem. This makes me think that somehow that the load directory references aren't being properly resolved. I've listed my config.load_paths. I have banged my head on this one for days now. If anyone can help I'd be super appreciative. Thank you.

Matt

LOAD PATHS: ["/Users/matt/dev/solar/app/controllers/"
"/Users/matt/dev/solar/app"
"/Users/matt/dev/solar/app/models"
"/Users/matt/dev/solar/app/controllers"
"/Users/matt/dev/solar/app/helpers"
"/Users/matt/dev/solar/lib"
"/Users/matt/dev/solar/vendor"
"/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/rails-2.3.5/lib/../builtin/rails_info/"
"/Users/matt/dev/solar/app/form_builders"]

STACK TRACE:

RuntimeError in AnalysisController#index

XML processor module not found.

RAILS_ROOT: /Users/matt/dev/solar
Application Trace | Framework Trace | Full Trace

/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb:74:in `'
:29:in `require'
:29:in `require'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/soap4r-1.5.8/lib/wsdl/parser.rb:12:in `'
:29:in `require'
:29:in `require'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/soap4r-1.5.8/lib/soap/wsdlDriver.rb:9:in `'
:29:in `require'
:29:in `require'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `block in require'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Users/matt/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/Users/matt/dev/solar/app/models/pv_array.rb:1:in `'
/Users/matt/dev/solar/app/helpers/application_helper.rb:20:in `'
/Users/matt/dev/solar/app/helpers/application_helper.rb:5:in `'
/Users/matt/dev/solar/app/controllers/application_controller.rb:4:in `'
/Users/matt/dev/solar/app/controllers/analysis_controller.rb:1:in `'

Re: soap4r + ruby 1.9.2 = "XML processor module not found"

Hi Matt,
I ran into the same issue. Using the 'require' statement in a irb session pointed me to the file
  /usr/local/lib/ruby/gems/1.9.1/gems/soap4r-1.5.8/lib/xsd/xmlparser.rb, line76.
Some line before that it talks about:
    # XXX: for a workaround of rubygems' require inconsistency
    # XXX: MUST BE REMOVED IN THE FUTURE
It apparently tries to match a library-defined constant with the library name in order to verify that the required lib got actually loaded. That comparison converts the found library constant to downcase, but it apparently gets a symbol, not a string, which keeps being a symbol and therefore the comparison always fails.

I think older Ruby versions treated a symbol as a string in that situation, so this looks like the problem here.

After changing the line

      c.downcase == name

to

      c.to_s.downcase == name

it did not bail out anymore in my irb (not tested on Rails yet...).

I hope this helps you to move on!


Best regards,

Torsten

Re: soap4r + ruby 1.9.2 = "XML processor module not found"

Hi Torsten,
Thank you very much. I will try that. I saw that comment in the file but didn't know how to fix it. I will try it in rails and post here. It will be a while, I'm in the middle of something else. Thank you again!
Matt

Re: soap4r + ruby 1.9.2 = "XML processor module not found"

This worked for me - thanks @torsten_on_rails!  I wouldn't have been able to figure this out on my own.

Re: soap4r + ruby 1.9.2 = "XML processor module not found"

oh boy - it worked for me too....zillion thanks...would not have gone to this depth on my own, thanks again.

Re: soap4r + ruby 1.9.2 = "XML processor module not found"

oh that's a great its also for me what a fine work you done for me...thanks lot