Programming Web Services with XML-RPC
by Simon St. Laurent, Dave Winer, Joe Johnston, Edd Wilder-James
Chapter 4. XML-RPC and Perl
XML-RPC and the Perl scripting language are a particularly powerful
combination for creating flexible web services rapidly. Perl has long been
the language of choice to obtain and manipulate data for the Web, and it
is moving into the growing field of web services. One of Perl’s guiding
philosophies is “Easy things should be easy, and hard things should be
possible.” The Perl module for XML-RPC, Frontier::RPC, embodies this.
To show how easy Perl’s XML-RPC library, Frontier::RPC, makes remote procedure calls,
consider the following code snippet:
use Frontier::Client;
my $client = Frontier::Client->new
( url => "http://example.com:1080");
print "helloWorld('Bob') returned: ",
$client->call('helloWorld', 'Bob'), "\n";Assume that on a machine called example.com,
there is an XML-RPC server running on port 1080 that has implemented a
procedure named helloWorld( ). Given
these assumptions, these three lines of Perl code are all that’s needed to
make an XML-RPC call. Although this chapter explores the details of using
this library more thoroughly, many XML-RPC Perl clients aren’t any more
complicated than this example.
This chapter begins with a discussion of the history, requirements,
and architecture of Perl’s XML-RPC library, Frontier::RPC. Then it covers how to create
XML-RPC clients and servers using Perl, including instructions for running
an XML-RPC server from a web server.
Perl’s Implementation of XML-RPC
As of this writing, there’s only one XML-RPC ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access