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