/*------------------------------------------------------------------------------
Name: xmlBlaster/demo/python/xmlrpc/deprecated/README
Project: xmlBlaster.org
Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
Comment: xmlBlaster access with Python clients using XmlRpc
Date: 2004-01-23
See: http://www.xmlBlaster.org/xmlBlaster/src/python/README
See: http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.python.html
------------------------------------------------------------------------------*/
NOTE: This code is outdated but still functional, please read
http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.python.html
Howto start the Python/XmlRpc demo:
- Start xmlBlaster
cd xmlBlaster
java -jar lib/xmlBlaster.jar
- Run the Python demo client
(Pass as argument the url where xmlBlaster listens,
xmlBlaster logs this url on your console)
cd xmlBlaster/demo/python
python hello.py http://myhost:8080
Thats it!
See
xmlBlaster/src/java/org/xmlBlaster/protocol/xmlrpc/XmlBlasterImpl.java
with all allowed server-methods you can invoke.
A callback Python demo (for asynchronous updates) is not yet available,
donations from Python hackers are welcome!
-------------------------------------------------------------------
Fredrik Lundh has provided the excellent XMLRPC library for Python.
http://www.pythonware.com/products/xmlrpc/
This three libs
xmlrpc_handler.py
xmlrpclib.py
xmlrpcserver.py
are provided in the xmlBlaster/demo/python directory.
Get more informations at
http://xmlrpc-c.sourceforge.net/xmlrpc-howto/xmlrpc-howto-python.html
-------------------------------------------------------------------
This is the simplest Python client code:
-------------------------------------------------------------------
import xmlrpclib
server_url = 'http://myHost:8080/';
server = xmlrpclib.Server(server_url);
print "\nSUCCESS: Connected to", server_url;
# Login to xmlBlaster
sessionId = server.authenticate.login( "ben", "secret", "", "mySessionId");
print "\nLogin success with sessionId=", sessionId;
# Call the server and get its current memory consumption.
message = server.xmlBlaster.get( sessionId, "", "");
print "Result for a get():\n\n", message;
# Logout from xmlBlaster
server.authenticate.logout( sessionId );
print "\nLogout done, bye.\n";
-------------------------------------------------------------------