2009-01-20 39 views
2

有没有人通过Xml-rpc使用Python或Perl来获取数据?来自Python/Perl的XML-RPC和Continuum

我使用的continuum.py库:

#!/usr/bin/env python 

from continuum import * 

c = Continuum("http://localhost:8080/continuum/xmlrpc") 

或:

#!/usr/bin/perl 

use Frontier::Client; 

my $url = "http://dev.server.com:8080/continuum/xmlrpc"; 

my $client = RPC::XML::Client->new($url); 

my $res = $client->send_request('system.listMethods'); 

print " Response class = ".(ref $res)."\n"; 
print " Response type = ".$res->type."\n"; 
print " Response string = ".$res->as_string."\n"; 
print " Response value = ".$res->value."\n"; 

得到:No such handler: system.listMethods

任何人表现更好......?

回答

1

是的......用Perl。我使用了XML::RPC。事实上,我使用它编写了CPAN模块WWW::FreshMeat::API来访问Freshmeats XML-RPC API,所以我知道它确实工作正常!

使用XML :: RPC与Freshmeat的 “系统。*” 我要求工作....

use XML::RPC; 
use Data::Dumper; 

my $fm = XML::RPC->new('http://freshmeat.net/xmlrpc/'); 

# need to put in your Freshmeat username/password here 
my $session = $fm->call('login', { username => 'user', password => 'pass' }); 

my $x = $fm->call('system.listMethods'); 

say Dumper($x); 

给我....

$VAR1 = [ 
     'system.listMethods', 
     'system.methodHelp', 
     'system.methodSignature', 
     'system.describeMethods', 
     'system.multiCall', 
     'system.getCapabilities', 
     'publish_release', 
     'fetch_branch_list', 
     'fetch_project_list', 
     'fetch_available_licenses', 
     'fetch_available_release_foci', 
     'fetch_release', 
     'login', 
     'logout', 
     'withdraw_release' 
     ]; 

希望有所帮助。

1

你描述的不是客户端库的一部分 - 这是服务器是否实现这些方法的问题。

我是RPC::XML Perl模块的作者,在我提供的服务器类中,我还提供了实现基本的“自省”API,它已经成为XML-RPC领域的一种半标准。但即使如此,服务器类的用户可能会选择不启用自检API。

当然,我不能说其他的XML-RPC实现。