[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problem with XMLRPC

Henrik Ronellenfitsch

1/11/2005 8:17:00 PM

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
2 Answers

rcoder@gmail.com

1/11/2005 8:40:00 PM

0

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

Henrik Ronellenfitsch

1/12/2005 6:58:00 PM

0

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