Problems with WSDL2ruby

Posted by Matt Osentoski Mon, 12 Feb 2007 21:04:00 GMT

The other day, I was trying to create a quick and dirty SOAP client for my Axis server, when I encounter the following error:

uninitialized constant SOAP::Mapping::EncodedRegistry (NameError)

Let me start from the beginning.. I installed soap4r using:
gem install soap4r
After soap4r was installed, I ran WSDL2ruby to create the SOAP client stubs.
wsdl2ruby.rb --wsdl http://localhost:8080/axis/services/someCoolService?wsdl --type client --force
Now that the client code had been generated, I launched the client and received the error message above. The problem was caused by Ruby grabbing the soap4r classes that are included in the distribution and not the gem. To fix this, explicitly point to the soap4r gem libary.

Solution


Open up the defaultMappingRegistry.rb file and make sure the require statements look like:
require 'default.rb'
require 'rubygems'
require_gem 'soap4r'
require 'soap/mapping'
NOTE:
require 'rubygems' --and--
require_gem 'soap4r'
were added.

Posted in  | Tags , , ,  | 4 comments