From: jm Date: 2005-05-13T22:42:44+09:00 Subject: strange error from soap server I came across this with a larger program to expose the functionality of a class via a SOAP interface. The original class passes all test, but the SOAP server generates a strange error which I have no idea how to solve even after staring at it for hours. The below is a very cut down version that produces the same error. It's most likely something to do with the way soap4r is being called in the server as the line protocol looks correct at a cursory glance, but where and what? See below for the source code. the client returns this error $ ruby lib/dummy_client.rb Loaded suite lib/dummy_client Started E Finished in 0.015137 seconds. 1) Error: test_ping_pong(DummySoap): SOAP::EncodingStyle::Handler::EncodingStyleError: Illegal parent: . /usr/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:253:in `decode_parent' /usr/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:131:in `as_struct' /usr/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:232:in `decode_parent' /usr/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:131:in `as_struct' /usr/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:232:in `decode_parent' /usr/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:142:in `as_string' /usr/lib/ruby/1.8/soap/encodingstyle/soapHandler.rb:202:in `decode_tag_end' /usr/lib/ruby/1.8/soap/parser.rb:191:in `decode_tag_end' /usr/lib/ruby/1.8/soap/parser.rb:152:in `end_element' /usr/lib/ruby/1.8/xsd/xmlparser/parser.rb:75:in `end_element' /usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:38:in `tag_end' /usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:26:in `parse' /usr/lib/ruby/1.8/rexml/document.rb:171:in `parse_stream' /usr/lib/ruby/1.8/xsd/xmlparser/rexmlparser.rb:27:in `do_parse' /usr/lib/ruby/1.8/soap/parser.rb:90:in `parse' /usr/lib/ruby/1.8/soap/processor.rb:39:in `unmarshal' /usr/lib/ruby/1.8/soap/rpc/proxy.rb:191:in `unmarshal' /usr/lib/ruby/1.8/soap/rpc/proxy.rb:118:in `invoke' /usr/lib/ruby/1.8/soap/rpc/proxy.rb:131:in `call' /usr/lib/ruby/1.8/soap/rpc/driver.rb:275:in `call' /usr/lib/ruby/1.8/soap/rpc/driver.rb:302:in `ping' /usr/lib/ruby/1.8/soap/rpc/driver.rb:297:in `ping' lib/dummy_client.rb:15:in `test_ping_pong' 1 tests, 0 assertions, 0 failures, 1 errors this error is logged by the server [2005-05-13 23:29:07] ERROR ArgumentError: wrong number of arguments (0 for 1) /usr/lib/ruby/1.8/soap/rpc/soaplet.rb:100:in `debug' /usr/lib/ruby/1.8/soap/rpc/soaplet.rb:100:in `do_POST' /usr/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `__send__' /usr/lib/ruby/1.8/webrick/httpservlet/abstract.rb:35:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' /usr/lib/ruby/1.8/webrick/server.rb:155:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:144:in `start' /usr/lib/ruby/1.8/webrick/server.rb:144:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:94:in `start' /usr/lib/ruby/1.8/webrick/server.rb:89:in `each' /usr/lib/ruby/1.8/webrick/server.rb:89:in `start' /usr/lib/ruby/1.8/webrick/server.rb:79:in `start' /usr/lib/ruby/1.8/webrick/server.rb:79:in `start' lib/dummy_soap.rb:36 #### dummy_soap.rb #!/usr/bin/ruby $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..","lib") require 'webrick' require 'soap/rpc/soaplet' class Dummy def ping 'pong' end end class HTTPAccessDenied < WEBrick::HTTPServerError; end #defaults basedir = File::dirname(File::expand_path(__FILE__)).split('/')[0..-2].join('/') logfilename = 'dummy.log' docroot = File.join(basedir,"html") s=WEBrick::HTTPServer.new( :BindAddress => "127.0.0.1", :Port => 3000, :Logger => WEBrick::Log::new(logfilename, WEBrick::Log::INFO), :DocumentRoot => docroot ) srv = SOAP::RPC::SOAPlet.new srv.add_servant(Dummy.new,'urn:FWControl') # Mount it at somewhere. s.mount("/soap", srv) trap("INT"){ s.shutdown } s.start ### dummy_client.rb #!/usr/bin/ruby $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..","lib") require 'test/unit' require 'soap/rpc/driver' URL="http://127.0.0.1:3000/soap" NS="urn:Dummy" class DummySoap < Test::Unit::TestCase def setup @proxy = SOAP::RPC::Driver.new(URL,NS) @proxy.add_method('ping') end def test_ping_pong assert_equal('pong',@proxy.ping) end end