<?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;: Category Ruby</title>
    <link>http://matt.osentoski.com/articles/category/ruby</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>Ruby named language of the year by Tiobe</title>
      <description>Ruby has been named language of the year by Tiobe and is now ranked in the top 10 languages.  Follow the link below to read the article:
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.tiobe.com/tpci.htm"&gt;http://www.tiobe.com/tpci.htm&lt;/a&gt;</description>
      <pubDate>Mon, 08 Jan 2007 10:25:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1f1e3315-d139-4e7c-a191-59413e521cce</guid>
      <author>Matt Osentoski</author>
      <link>http://matt.osentoski.com/articles/2007/01/08/ruby-declared-language-of-the-year-by-tiobe</link>
      <category>Ruby</category>
      <category>Ruby</category>
    </item>
  </channel>
</rss>
