Problem with XMLRPC

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

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

rcoder wrote:

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 :slight_smile: