source: products/XMLRPCMethod/XMLRPCMethod-1-1/README.txt @ 1591

Last change on this file since 1591 was 19, checked in by myroslav, 18 years ago

Layout changes, typos corrected

  • Property svn:eol-style set to native
File size: 3.4 KB
Line 
1XMLRPC Methods
2
3  The XMLRPC Method product provides support for remote procedure
4  calls with the "XML-RPC":http://www.xml-rpc.com standard.
5  The intent is to create a plug-in replacement for an external method.
6
7  Not everything is callable: For instance you can't call title or id
8  on a folder, but you can call 'title_or_id', 'title_and_id', 'getId'
9  and 'getPhysicalPath'. Essentially everything that will also work as
10  'http://remote.com/folder/title_or_id'. The method 'propertyItems' returns
11  an especially complex and interesting result.
12
13  You can also do privileged things that requires a login. You simply
14  add the username and password to the remote url the conventional way:
15
16    http://username:password@remote.com/
17
18  Then you can call methods such as 'document_src' on DTML methods etc.
19
20Sending arguments
21
22  XMLRPC allows you to send a number of arguments to the remote
23  procedure. These arguments can be integers, strings, lists, dictionaries
24  etc. and combinations hereof.
25
26  To test with the XMLRPCLIB example, create a XMLRPC method with the
27  name 'statelookup', the URL 'http://betty.userland.com' and the method
28  'examples.getStateName'.
29
30  The create a DTML method with the call: '<dtml-var "statelookup(5)">'
31  and see what happens.
32
33Sending arguments to remote DTML Methods
34
35  Try this: create a DTML method with address /welcome on the remote
36  computer with the two lines::
37
38    <dtml-call "REQUEST.set('res', 'Welcome to ' + place )">
39    <dtml-return "REQUEST['res']">
40
41  Then on the local computer create an XMLRPC method called querywelcome
42  with the URL http://remote.com/, and a method of welcome.
43
44  To call the remote procedure from a DTML Method do::
45
46    <dtml-var "querywelcome( {'place':'my world'}) ">
47
48  If the method returns a list or a dictionary, you can use the &lt;dtml-in *method* mapping>
49 
50Calling a Z SQL Method:
51
52  You can't do it directly. The Z SQL Method returns objects, so you
53  must use a DTML Method to build a list of dictionaries. Let's assume
54  we have a table with the two columns 'ISSUE_ID' and 'ISSUE_NAME'. Then
55  your DTML Method will look like this::
56
57    <dtml-call "REQUEST.set('result',[])">
58    <dtml-in select_all_from_issues>
59    <dtml-call "REQUEST['result'].append({'ID': ISSUE_ID, 'NAME':ISSUE_NAME}) ">
60    </dtml-in>
61    <dtml-return "REQUEST['result']">
62
63Other things to note:
64
65  When an object is called via XML-RPC, there's nothing in the REQUEST
66  variable. You can create variables in the namespace, but that's it. Some
67  versions of Zope can't see simple variables.  So in the example above you
68  have to write '<dtml-return "REQUEST[&apos;result&apos;]">' rather than
69  '<dtml-return result>' to be one the safe side.
70
71  Due to its nature XMLRPC methods can take a long time to execute or
72  not return at all if the remote server is unresponsive. Therefore make
73  use of the timeout value. The timeout functionality is implemented
74  with threads.
75
76  Another optimization technique available to you is to cache the results.
77  We have made XMLRPCMethod cacheable with RAMCacheManager.
78
79Bugs
80
81  XML-RPC takes only positional parameters. Since arguments given in
82  the 'QUERY_STRING' are keyword arguments as in ?x=1&amp;y=2
83  it isn't possible to specify arguments in GET or POST statements.
84
85  The &lt;dateTime.iso8601&gt; element is difficult to use. It is not
86  converted to a Zope DateTime.
87
88References
89
90  "Directory of services":http://www.xmlrpc.com/directory/1568/services
Note: See TracBrowser for help on using the repository browser.