From: Mike Calder Date: 2004-05-01T20:40:48+09:00 Subject: Class resolution problem Please bear with me, I'm a beginner, and I'm beginning to think, of very little brain. I'm trying to run a few of the standard samples and look at the code to learn Ruby. Currently I'm on raabrowser. I think I've loaded all the dependencies, but I get an error - ruby raabrowser.rb Loading devel/logger compatibility library... /usr/local/lib/ruby/site_ruby/1.8/soap/streamHandler.rb:198:in `send_post': 404: Not Found (SOAP::HTTPStreamError) from /usr/local/lib/ruby/site_ruby/1.8/soap/streamHandler.rb:93:in `send' from /usr/local/lib/ruby/site_ruby/1.8/soap/rpc/proxy.rb:108:in `invoke' from /usr/local/lib/ruby/site_ruby/1.8/soap/rpc/proxy.rb:117:in `call' from /usr/local/lib/ruby/site_ruby/1.8/soap/rpc/driver.rb:195:in `call' from (eval):2:in `getProductTree' from ./RAA.rb:23:in `__send__' from ./RAA.rb:23:in `method_missing' from raabrowser.rb:108:in `initialize' from raabrowser.rb:131:in `new' from raabrowser.rb:131 OK, I look at the stacktrace and follow the source code, it all makes sense down to StreamHandler. The code I have is in /usr/local/lib/ruby/site_ruby/1.8/soap/StreamHandler.rb: line 93: send_post(conn_data, soapaction, charset) ine 198: raise HTTPStreamError.new("#{ res.status }: #{ res.reason }") So presumably I have to find a class definition of HTTPStreamError. A grep of /usr/local/lib/ruby/site_ruby/1.8/soap gives: grep "HTTPStreamError" *.rb soap.rb:class HTTPStreamError < StreamError; end soap.rb:class PostUnavailableError < HTTPStreamError; end soap.rb:class MPostUnavailableError < HTTPStreamError; end streamHandler.rb: raise HTTPStreamError.new("#{ res.status }: #{ res.reason }") so I look in soap.rb and find, sometime after a "module SOAP" declaration, so we're looking in the right place, the following code: >> class Error < StandardError; end >> >> class StreamError < Error; end >> class HTTPStreamError < StreamError; end >> class PostUnavailableError < HTTPStreamError; end >> class MPostUnavailableError < HTTPStreamError; end which to my little brain includes a definition of the class we should be looking for (SOAP::HTTPStreamError) and basically equivalences it to StandardError (via SOAP::StreamError and SOAP::Error), which I presume is a core class, so I try that: ruby -e 'class HTTPStreamHandler < StandardError; end; p HTTPStreamHandler' HTTPStreamHandler Yup, that works. so, the problem must be that soap.rb is not being included or is otherwise failing? But /usr/local/lib/ruby/site_ruby/1.8/soap/StreamHandler.rb has >> require 'soap/soap' which I presume points to /usr/local/lib/ruby/site_ruby/1.8/soap/soap.rb, and there is no Load Error message or other indication that soap.rb contains bad code. What am I missing? -- Clear skies! Mike Calder.