[ZDP] BackTalk to Document Zope Developer's Guide (2.4
edition)/Object Publishing
webmaster at zope.org
webmaster at zope.org
Thu May 27 18:29:09 EDT 2004
A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZDG/current/ObjectPublishing.stx#3-100
---------------
XML-RPC supports marshalling of basic Python types for both
publishing requests and responses. The upshot of this
arrangement is that when you are designing methods for use via
XML-RPC you should limit your arguments and return values to
simple values such as Python strings, lists, numbers and
dictionaries. You should not accept or return Zope objects from
methods that will be called via XML-RPC.
% Anonymous User - Aug. 18, 2002 9:08 pm:
Hm, I keep getting the same kind of error when trying these example calls to 'getId()' etc.:
<Fault -1: 'Unexpected Zope exception: cannot marshal <extension class Acquisition.ImplicitAcquirerWrapper at
401a8840> objects'>
So this is the kind of Zope object that won't be returned? I'd love to see some *working* examples of XML-RPC
in Zope (please).
% godefroy - May 27, 2004 6:29 pm:
The simpliest possible usage of XMLRPC in Zope:
As you probably know, "files" are folders' methods in Zope. So, you can put a Page Template in root
directory, and name it abc. Now abs is a method of / folder. Later you can put something more dynamic instead
of Page Template. For now, just delete contents of abc Page Template and replace them with single line of
text: "hello world".
This is a working example of XMLRPC Server for Zope. Cool, isn't it?
To test it:
1) run python
2) issue commands:
>>> import xmlrpclib
>>> s = xmlrpclib.Server('http://localhost:8080/')
>>> s.abc()
3) you should get methods result:
'hello, world\n'
(Assumed that Zope is on localhost:8080, and you have abc method (file, page template, whatever) in root
directory.)
More information about the ZDP
mailing list