|
Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://rtm-cs.sinp.msu.ru/manual/xmlrpc-howto/xmlrpc-howto-intro.html
Дата изменения: Mon Jan 22 01:11:58 2001 Дата индексирования: Mon Oct 1 21:19:26 2012 Кодировка: |
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.)
>>> import xmlrpclib
>>> server = xmlrpclib.Server("http://betty.userland.com/RPC2")
>>> 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.