XML-RPC is a simple, portable way to make remote procedure calls over HTTP. It can be used with Perl, Java, Python, C, C++, PHP and many other programming languages. Implementations are available for Unix, Windows and the Macintosh.
Here's a short XML-RPC client written in Perl. (We use Ken MacLeod's Frontier::Client module.)
use Frontier::Client; $server = Frontier::Client->new(url => 'http://betty.userland.com/RPC2'); $name = $server->call('examples.getStateName', 41); print "$name\n";
When run, this program will connect to the remote server, get the state name, and print it. (State #41 should be South Dakota in this example.)
Here's the same program in Python. (This time, we use Fredrik Lundh's xmlrpclib.)
python> import xmlrpclib python> server = xmlrpclib.Server("http://betty.userland.com/RPC2") python> server.examples.getStateName(41) 'South Dakota'
In the following chapters, you'll learn how to write XML-RPC clients and servers in a variety of programming languages.