Front page | perl.fwp |
Postings from March 2002
PGAS Web Service
Thread Next
From:
Dave Hoover
Date:
March 12, 2002 19:26
Subject:
PGAS Web Service
Message ID:
NFBBLBJAALMELNDMDOFCGEGFCFAA.dave@redsquirreldesign.com
Inspired by Yanick's hack of the PGAS leaderboard
(http://babyl.dyndns.org/golf/), I was fiddling around with SOAP::Lite
tonight and got XML-RPC working with PGAS. PGAS now has a web service that
allows people to query the database through Remote Procedure Calls. I've
only created one method so far, but adding more will be trivial now that the
details are worked out.
If you're interested in playing with it, here's a brief example of how to
write a client and call the method:
#!perl -w
use strict;
use XMLRPC::Lite;
my $aref = XMLRPC::Lite
-> proxy('http://perlgolf.sourceforge.net/cgi-bin/PGAS/service')
-> call('PGAS.getGolferID', 'Ton')
-> result;
foreach my $golfer (@$aref) {
print "ID = $golfer->{id}, NAME = $golfer->{name}\n";
}
As you can see, the method 'getGolferID' takes one argument (all or part of
a golfer's name) and returns a reference to an array of hashes. The hashes
have two keys (name & id). Multiple golfers will be returned when the name
passed to the method ('Ton' in the example above) matches more than one
golfer.
I'll be adding more methods before TPR(0,2) so please let me know if you
have any requests.
Enjoy,
--Dave
Thread Next
-
PGAS Web Service
by Dave Hoover