<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>&amp;lt;blog&amp;gt;Matt Osentoski&amp;lt;/blog&amp;gt;: Problems with WSDL2ruby</title>
    <link>http://matt.osentoski.com/articles/2007/02/12/uninitialized-constant-soap-mapping-encodedregistry-nameerror</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Problems with WSDL2ruby</title>
      <description>The other day, I was trying to create a quick and dirty SOAP client for my Axis server,  when I encounter the following error: 
&lt;br /&gt;&lt;br /&gt;
&lt;strong&gt;
uninitialized constant SOAP::Mapping::EncodedRegistry (NameError)
&lt;/strong&gt;
&lt;br /&gt;
&lt;br /&gt;
Let me start from the beginning..  I installed soap4r using:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&lt;notextile&gt;gem install soap4r&lt;/notextile&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
After soap4r was installed, I ran WSDL2ruby to create the SOAP client stubs.
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&lt;notextile&gt;wsdl2ruby.rb --wsdl http://localhost:8080/axis/services/someCoolService?wsdl --type client --force&lt;/notextile&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

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.
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Solution&lt;/h3&gt;
&lt;br /&gt;
Open up the &lt;strong&gt;defaultMappingRegistry.rb&lt;/strong&gt; file and make sure the require statements look like:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&lt;notextile&gt;require 'default.rb'
require 'rubygems'
require_gem 'soap4r'
require 'soap/mapping'&lt;/notextile&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;strong&gt;NOTE:&lt;/strong&gt;&lt;br /&gt;
require 'rubygems'  --and--&lt;br /&gt;
require_gem 'soap4r'
&lt;br /&gt;were added.</description>
      <pubDate>Mon, 12 Feb 2007 16:04:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:ebaef2c5-6395-4e89-a40e-c03a3cb63c72</guid>
      <author>Matt Osentoski</author>
      <link>http://matt.osentoski.com/articles/2007/02/12/uninitialized-constant-soap-mapping-encodedregistry-nameerror</link>
      <category>Ruby</category>
      <category>Ruby</category>
      <category>soap4r</category>
      <category>wsdl2ruby</category>
      <category>wsdl</category>
    </item>
    <item>
      <title>"Problems with WSDL2ruby" by corsiingleseijn</title>
      <description> Hello colleagues! 
you made a exclusive site !.. 
I saw posts where man was need to find &lt;a&gt;corsi di guida&lt;/a&gt; 
Sicurezza lingua diventare dei corsi di formazione scuola vino offre professionale area e tecnologia corsi di formazione. 
And.. I want to find complete information about &lt;a href="http://formazione-rspp.italy-school.com/"&gt;http://formazione-rspp.italy-school.com/&lt;/a&gt; - formazione rspp 
I assume, We searched badly :-( 
 
 
 
 
</description>
      <pubDate>Wed, 30 May 2007 17:25:21 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:a5ac6a3a-fad8-4280-afcc-4cd55edab4ed</guid>
      <link>http://matt.osentoski.com/articles/2007/02/12/uninitialized-constant-soap-mapping-encodedregistry-nameerror#comment-10</link>
    </item>
    <item>
      <title>"Problems with WSDL2ruby" by John L</title>
      <description>Yow.  Nice solution.  Thanks for the post.  </description>
      <pubDate>Tue, 10 Apr 2007 12:03:37 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0c0b7651-b99e-4b2d-ae66-354e0d90ec88</guid>
      <link>http://matt.osentoski.com/articles/2007/02/12/uninitialized-constant-soap-mapping-encodedregistry-nameerror#comment-9</link>
    </item>
    <item>
      <title>"Problems with WSDL2ruby" by Fred Alger</title>
      <description>
For those mired in getting SOAP4R to work with Rails, see this thread on the SOAP4R list:

&lt;a href="http://groups.google.com/group/soap4r/browse_thread/thread/17175f520bfc520f"&gt;http://groups.google.com/group/soap4r/browse_thread/thread/17175f520bfc520f&lt;/a&gt;</description>
      <pubDate>Mon, 12 Mar 2007 13:38:30 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0ee4df4b-3d53-460f-af6b-7b50d7a9998e</guid>
      <link>http://matt.osentoski.com/articles/2007/02/12/uninitialized-constant-soap-mapping-encodedregistry-nameerror#comment-8</link>
    </item>
    <item>
      <title>"Problems with WSDL2ruby" by Fred Alger</title>
      <description>Note that require_gem is deprecated; new syntax is simply:

gem 'soap4r'


-----


I seem to be stuck with the same "unintialized constant" while integrating a SOAP-based payment service into my Rails app. :-)</description>
      <pubDate>Mon, 12 Mar 2007 13:35:27 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:877c2365-82a4-4645-962b-a4238c999a5c</guid>
      <link>http://matt.osentoski.com/articles/2007/02/12/uninitialized-constant-soap-mapping-encodedregistry-nameerror#comment-7</link>
    </item>
  </channel>
</rss>
