strange error from soap server

J

jm

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
 
J

jm

Seems that SOAP::RPC::StandaloneServer uses inherits from
Logger::Application which uses the call to
Logger::debug(progname = nil, &block) which is different to the call
to WEBrick::Logger.debug(msg). So that changing the logger, thusly,

logger = Logger.new(logfilename)
logger.level = Logger::INFO

s=WEBrick::HTTPServer.new(
:BindAddress => "127.0.0.1",
:port => 3000,
:Logger => logger
)

fixes the problem. Any chance this will be straightened out in the next
release as this through me for a six.

J.

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
 
P

Paul Battley

=20
Seems that SOAP::RPC::StandaloneServer uses inherits from
Logger::Application which uses the call to
Logger::debug(progname =3D nil, &block) which is different to the call
to WEBrick::Logger.debug(msg). So that changing the logger, thusly,
=20
logger =3D Logger.new(logfilename)
logger.level =3D Logger::INFO
=20
s=3DWEBrick::HTTPServer.new(
:BindAddress =3D> "127.0.0.1",
:port =3D> 3000,
:Logger =3D> logger
)
=20
fixes the problem. Any chance this will be straightened out in the next
release as this through me for a six.

Ah yes, I was hit by the same bug, and just reverted to 1.8.1.

HTTP authentication in WEBrick is also broken in 1.8.2:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/25336
(In Japanese, but I'm sure you can read the diff)

The decode64 issue that affects HTTP authentication is fixed in 1.9;
the logging code is unchanged in the latest version that I have
downloaded. I don't know whether more recent versions of 1.9 address
that as well.

Paul.
 
N

NAKAMURA, Hiroshi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Sorry for late reply.
Seems that SOAP::RPC::StandaloneServer uses inherits from
Logger::Application which uses the call to
Logger::debug(progname = nil, &block) which is different to the call to
WEBrick::Logger.debug(msg). So that changing the logger, thusly,

logger = Logger.new(logfilename)
logger.level = Logger::INFO

s=WEBrick::HTTPServer.new(
:BindAddress => "127.0.0.1",
:port => 3000,
:Logger => logger
)

fixes the problem. Any chance this will be straightened out in the next
release as this through me for a six.

I added methods for the compatibility to soap4r-1.5.4 release. It will
be included in ruby-1.8.3 (already committed). Would you please check
soap4r-1.5.4 or next release of ruby-1.8.3 (preview2 or later).

Regards,
// NaHi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFCmcyKf6b33ts2dPkRAoHrAJ4wHZCxzAQn0tG5fkUKJFK9LBipuACbBQzl
33fFqDJNEtwUgr2B8/78FTQ=
=79Dr
-----END PGP SIGNATURE-----
 
J

jm

I added methods for the compatibility to soap4r-1.5.4 release. It will
be included in ruby-1.8.3 (already committed). Would you please check
soap4r-1.5.4 or next release of ruby-1.8.3 (preview2 or later).


Would be glad to. Would you mind adding a note to your soap4r webpage
if you haven't already as this is the first place I look when I have
problems.

much thanks,

J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,078
Latest member
MakersCBDBlood

Latest Threads

Top