P
Phil Tomson
We've been trying to run the following XMLRPC client code to connect to a
server written in C with xmlrpc-c:
require "xmlrpc/client"
server_url,class_name = *ARGV
if ARGV.length != 2
puts "USAGE: ruby queryclass.rb SERVER_URL CLASS_NAME"
#exit
end
puts "server_url is: #{server_url}"
puts "class_name is: #{class_name}"
server = XMLRPC::Client.new("localhost", "/RPC2", 8081)
result = server.call("queryClass", class_name)
puts "result.class is: #{result.class}"
We're getting this error:
class_name is: services
/usr/local/lib/ruby/1.8/net/protocol.rb:133:in `sysread': Connection
reset by peer (Errno::ECONNRESET)
from /usr/local/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
from /usr/local/lib/ruby/1.8/timeout.rb:56:in `timeout'
from /usr/local/lib/ruby/1.8/timeout.rb:76:in `timeout'
from /usr/local/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
from /usr/local/lib/ruby/1.8/net/protocol.rb:104:in `read_all'
from /usr/local/lib/ruby/1.8/net/http.rb:2186:in `read_body_0'
from /usr/local/lib/ruby/1.8/net/http.rb:2139:in `read_body'
from /usr/local/lib/ruby/1.8/net/http.rb:2164:in `body'
... 6 levels...
from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:535:in `do_rpc'
from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:420:in `call2'
from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:410:in `call'
from queryclass.rb:13
any ideas?
I'm running on Suse Linux 10.0.
We've got an equivilent perl script which uses Frontier::Client that works
fine:
#!/usr/bin/perl -w
use Frontier::Client;
my ($server_url, $class_name) = @ARGV;
if (@ARGV != 2) {
print "USAGE queryClass.pl SERVER_URL CLASS_NAME\n";
exit;
}
my $server = Frontier::Client->new(url => $server_url);
$result = $server->call("queryClass", $class_name);
my @a = @$result;
foreach (@a) {
my %h = %$_;
print $h{"id"} . "; " . $h{"type"} . "; " . $h{"state"} . "\n";
}
(equivilent except that I hardcoded some of the values in the Ruby version)
Any idea why the Ruby version is having trouble?
Phil
server written in C with xmlrpc-c:
require "xmlrpc/client"
server_url,class_name = *ARGV
if ARGV.length != 2
puts "USAGE: ruby queryclass.rb SERVER_URL CLASS_NAME"
#exit
end
puts "server_url is: #{server_url}"
puts "class_name is: #{class_name}"
server = XMLRPC::Client.new("localhost", "/RPC2", 8081)
result = server.call("queryClass", class_name)
puts "result.class is: #{result.class}"
We're getting this error:
server_url is: localhostruby queryclass.rb localhost services
class_name is: services
/usr/local/lib/ruby/1.8/net/protocol.rb:133:in `sysread': Connection
reset by peer (Errno::ECONNRESET)
from /usr/local/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
from /usr/local/lib/ruby/1.8/timeout.rb:56:in `timeout'
from /usr/local/lib/ruby/1.8/timeout.rb:76:in `timeout'
from /usr/local/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
from /usr/local/lib/ruby/1.8/net/protocol.rb:104:in `read_all'
from /usr/local/lib/ruby/1.8/net/http.rb:2186:in `read_body_0'
from /usr/local/lib/ruby/1.8/net/http.rb:2139:in `read_body'
from /usr/local/lib/ruby/1.8/net/http.rb:2164:in `body'
... 6 levels...
from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:535:in `do_rpc'
from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:420:in `call2'
from /usr/local/lib/ruby/1.8/xmlrpc/client.rb:410:in `call'
from queryclass.rb:13
any ideas?
I'm running on Suse Linux 10.0.
We've got an equivilent perl script which uses Frontier::Client that works
fine:
#!/usr/bin/perl -w
use Frontier::Client;
my ($server_url, $class_name) = @ARGV;
if (@ARGV != 2) {
print "USAGE queryClass.pl SERVER_URL CLASS_NAME\n";
exit;
}
my $server = Frontier::Client->new(url => $server_url);
$result = $server->call("queryClass", $class_name);
my @a = @$result;
foreach (@a) {
my %h = %$_;
print $h{"id"} . "; " . $h{"type"} . "; " . $h{"state"} . "\n";
}
(equivilent except that I hardcoded some of the values in the Ruby version)
Any idea why the Ruby version is having trouble?
Phil