Some old (2001) instructions for accessing XML-RPC using Perl. Also take a look at the XML-RPC Perl tutorial on xml-rpc.com !
According to a customer the information below is indeed outdated ;-)
Apparently the Frontier module is not available anymore, instead you can
use the SOAP::Lite module which not
only provides SOAP, but also XML-RPC client functionality.
A small code snippet to access OpenGroupware.org:
use XMLRPC::Lite;
use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1;
>
my $fkt = "person.getById";
my $para = "10000";
>
my $result = XMLRPC::Lite
-> proxy('http://root:rootpwd@165.0.0.10:20000')
-> $fkt($para);
print Dumper($result->paramsall), '';
Thanks to Mr. Hanusch for providing this information !
To use XMLRPC with Perl, you first need these Perl modules installed on your machine (SuSE 7.2 tested) :
If you untar'ed and ungzip'ed the package, you just need to issue the following commands to install the client on your system :
To show you how to use Perl and XMLRPC to access a OGo server, here's a little code example that shows the essential steps.
#!/usr/bin/perl
# 'include' the XMLRPC client
use Frontier::Client;
# init the client with the target url, login & password
$client = Frontier::Client->new( url =>
"http://login:password@your.server.com:10000");
# send a message to fetch persons with a name like 'zaphod',
# store the result in @result
@result = $client->call('person.fetch',"name like \'*zaphod*\'");
# check how many records we received
$count = @{$result[0]};
# iterate over the results
for $i (0 .. $count-1)
{
# get the current element
$element = $result[0]->[$i];
# get the name of the current element
$name = $element->{"name"};
}