Problem with XMLRPC

  • Thread starter Henrik Ronellenfitsch
  • Start date
H

Henrik Ronellenfitsch

Hello,
I was just playing a bit with Ruby's XMLRPC and created a very simple
server and client script.
Here's the server:

require "xmlrpc/server"
server = XMLRPC::Server.new(8080)
server.add_handler("say_hello") do
puts "Hello"
end
server.serve

and the client:

require "xmlrpc/client"
serv = XMLRPC::Client.new("localhost", "/" , 8080)
serv.call("say_hello")

Couldn't be more simple, could it? But strangely, when I try to start
the client script, I get the following error:

[searinox@sto Desktop]$ ruby -w clnt.rb
/usr/lib/ruby/1.8/xmlrpc/client.rb:535:in `do_rpc': HTTP-Error: 500
Internal Server Error (RuntimeError)
from /usr/lib/ruby/1.8/xmlrpc/client.rb:409:in `call2'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:399:in `call'
from clnt.rb:5

Where did I make a mistake?

Thanks,
Henrik
 
R

rcoder

XMLRPC requires a return value from every call, and 'nil' isn't
supported by the protocol. Try changing the server-side handler block
so that it returns a valid XMLRPC datatype value -- for example, just
add a line after the 'puts' call with a 0 and nothing else.

Lennon
 
H

Henrik Ronellenfitsch

rcoder said:
XMLRPC requires a return value from every call, and 'nil' isn't
supported by the protocol. Try changing the server-side handler block
so that it returns a valid XMLRPC datatype value -- for example, just
add a line after the 'puts' call with a 0 and nothing else.

Lennon

Thank you very much, that helped :)
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top