Log in |
XMLRPC - study the sourcePrefaceAlright, this is not a How To. Its more of a small tour of the Zope source. We will be looking at how ZPublisher implements the xmlrpc magic. The source I'm referring to is based on Zope 2.3.1 ZPublisher/HTTPRequest.py Have a look at Now XMLRPC arguments are not parsed by FieldStorage, so that falls into the procedure below, and parses an xmlrpc call into method and arguments. At this stage, remember that XMLRPC arguments are positional, and not by keywords. Since XMLRPC calls have no keywords, ZPublisher can't bind the arguments against variable names. So if you have a look at the REQUEST variable, it doesn't contain the parameters you passed. At the end of processInputs,HTTPRequest.other['PATH_INFO'] = XMLRPC method path, eg. http://yourhost/yourObject/yourMethodName HTTPRequest.args =
XMLRPC arguments (as a tuple) eg. (15, ZPublisher/publish.pyNow we fast forward to publish.py, where yourhost/yourObject/yourMethod is about to get published via xmlrpc. Search for ZPublisher/mapply.pyThe function signature for mapply is as follows:
def mapply(object, positional=(), keyword={}, debug=None, maybe=None, missing_name=default_missing_name, handle_class=default_handle_class, context=None, bind=0, Note that the REQUEST.args is passed in as positional parameters, while REQUEST is passed in as a dictionary. If you are calling a pythonscript or external method, then positional parameters of the function is lined up with the parameters passed in from the REQUEST. If you are calling a DTML method, however, things are a bit different. |