Differences between revisions 1 and 2
Revision 1 as of 2004-04-28 05:58:21
Size: 1322
Editor: dsl254-010-130
Comment: commited from SeaPIG with permission of author
Revision 2 as of 2004-07-20 04:42:52
Size: 1036
Editor: dsl254-010-130
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
''The page contents below were copied with permission of author (BrianDorsey) from [http://www.seapig.org/DocXMLRPCServer SeaPig:DocXMLRPCServer]. I'd like to rework the page to fit the form of WorkingWithTime, RssLibraries, etc.,. See also: DocXmlRpcServer'' -- LionKimbro [[DateTime(2004-04-28T05:58:21Z)]] #pragma section-numbers off
= XML-RPC =
Line 3: Line 4:
XML-RPC makes calling remote functions incredibly easy. XML-RPC is a neat way to send messages across the Internet.
Line 5: Line 6:
From http://www.xml-rpc.com:
''It's a spec and a set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet.
The neat thing about XML-RPC is that it transports ''native data structures''- you can ship off lists, strings, dictionaries, and numbers.
Line 8: Line 8:
It's remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.'' You can [wiki:Wiki/XmlRpc read more about it over on C2,] or on [http://www.xml-rpc.com/ the XML-RPC home page.]
Line 10: Line 10:

Here is a bit of sample code to call a procedure ''message'' (passing in the first argument) on a server listening on localhost, port 8000:
== Sample Code ==
Line 14: Line 13:
# messageclient.py import xmlrpclib
Line 16: Line 15:
import xmlrpclib
import sys
XMLRPC_SERVER_URL = "http://www.python.org/cgi-bin/moinmoin/?action=xmlrpc"
Line 19: Line 17:
if len(sys.argv) > 1:
    s = xmlrpclib.ServerProxy('http://localhost:8000')
    s.message(sys.argv[1])
pythoninfo = xmlrpclib.ServerProxy( XMLRPC_SERVER_URL )
allpages = pythoninfo.getAllPages() # this is the XML-RPC call
Line 23: Line 20:
print ", ".join( allpages )
Line 25: Line 23:
(also, see [http://www.python.org/doc/current/lib/xmlrpc-client-example.html this example] and the [http://www.python.org/doc/current/lib/module-xmlrpclib.html xmlrpclib documentation]) This code calls the PythonInfo wiki, and receives the TitleIndex as a list.
Line 27: Line 25:
== See Also ==

 * [http://www.python.org/doc/current/lib/xmlrpc-client-example.html official xmlrpclib example]
 * [http://www.python.org/doc/current/lib/module-xmlrpclib.html xmlrpclib documentation]
 * DocXmlRpcServer - class to help make an XML-RPC server

= Discussion =

  (none yet!)

XML-RPC

XML-RPC is a neat way to send messages across the Internet.

The neat thing about XML-RPC is that it transports native data structures- you can ship off lists, strings, dictionaries, and numbers.

You can [wiki:Wiki/XmlRpc read more about it over on C2,] or on [http://www.xml-rpc.com/ the XML-RPC home page.]

Sample Code

   1 import xmlrpclib
   2 
   3 XMLRPC_SERVER_URL = "http://www.python.org/cgi-bin/moinmoin/?action=xmlrpc"
   4 
   5 pythoninfo = xmlrpclib.ServerProxy( XMLRPC_SERVER_URL )
   6 allpages = pythoninfo.getAllPages() # this is the XML-RPC call
   7 
   8 print ", ".join( allpages )

This code calls the PythonInfo wiki, and receives the TitleIndex as a list.

See Also

Discussion

  • (none yet!)

XmlRpc (last edited 2018-02-28 14:58:40 by aurelien)

Unable to edit the page? See the FrontPage for instructions.