why this xmlrpc call do not work ?

M

Marcin Jurczuk

Hello.
I'm trying setup some xmlrpc connection and I'm having problem at start :(
Here is the most simple server and client and it is not working :(
----SERVER----
andromeda xmlserver # cat s.rb
#!/usr/bin/ruby
require "xmlrpc/server"

s = XMLRPC::Server.new(8080)

s.add_handler("/","sample.sumAndDifference") do |a,b|
{ "sum" => a + b, "difference" => a - b }
end

s.serve
----SERVER----
----CLIENT----
andromeda xmlserver # cat c.rb
#!/usr/bin/ruby
require "xmlrpc/client"

server = XMLRPC::Client.new( "localhost", "/",8080)

result = server.call("sample.sumAndDifference", 5, 3)
sum = result["sum"]
difference = result["difference"]
puts "Sum: #{sum}, Difference: #{difference}"
andromeda xmlserver #
----CLIENT-----
And here is result:
Client:
andromeda xmlserver # ./c.rb
/usr/lib/ruby/1.8/xmlrpc/client.rb:546:in `do_rpc':
HTTP-Error: 404 Not Found (RuntimeError)
from /usr/lib/ruby/1.8/xmlrpc/client.rb:420:in `call2'
from /usr/lib/ruby/1.8/xmlrpc/client.rb:410:in `call'
from ./c.rb:8
andromeda xmlserver #
Server log:
andromeda xmlserver # ./s.rb
[2006-01-16 13:34:51] INFO WEBrick 1.3.1
[2006-01-16 13:34:51] INFO ruby 1.8.3 (2005-09-21) [i686-linux]
[2006-01-16 13:34:51] INFO WEBrick::HTTPServer#start: pid=3616 port=8080
[2006-01-16 13:34:54] ERROR `/' not found.
localhost - - [16/Jan/2006:13:34:54 CET] "POST / HTTP/1.1" 404 270
- -> /

Looks like there is some path problem - but where ??

Of course this is simple client <-> server - real one have the same
error..

Best regards
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top