Zope2 and XMLRPC methods
Hi, I'm having some trouble getting XML-RPC methods going on Zope2/Five. I've got the following in my configure.zcml: <configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:five="http://namespaces.zope.org/five" xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc"> <include package="zope.app.publisher.xmlrpc" file="meta.zcml" /> <include package="zope.app.security" file="meta.zcml" /> <xmlrpc:view for="MZCore.interface.IMZTag" methods="smeg" class="MZCore.MZTag.MZTag.MZTagXmlRpcInterface" permission="zope.Public" /> </configure> and MZTag.py has the following in it: from zope.app.publisher.xmlrpc import XMLRPCView class MZTagXmlRpcInterface(XMLRPCView): def smeg(self): """something """ return 'hello!' But when I try to access the method via XML-RPC as follows (where aaa is and object that implements IMZTag)
s = ServerProxy('http://admin:admin@192.168.69.135:9673/aaa') s.smeg()
I get an error back saying "Cannot locate object at: http://192.168.69.135:9673/aaa/smeg" I'm at a loss now as what to try next. If I change the method name in either the configure.zcml or python files I get an error back saying that the method cannot be found when the .zcml file is parsed so I know it is being included. Does anyone have any ideas? Thanks, Rowan
On Tue, Feb 17, 2009, Rowan Woodhouse wrote:
Hi,
I'm having some trouble getting XML-RPC methods going on Zope2/Five. I've got the following in my configure.zcml:
<configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:five="http://namespaces.zope.org/five" xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc">
<include package="zope.app.publisher.xmlrpc" file="meta.zcml" /> <include package="zope.app.security" file="meta.zcml" />
<xmlrpc:view for="MZCore.interface.IMZTag" methods="smeg" class="MZCore.MZTag.MZTag.MZTagXmlRpcInterface" permission="zope.Public" />
</configure>
...
But when I try to access the method via XML-RPC as follows (where aaa is and object that implements IMZTag)
I am probably using an older version of zope, but the following is working for me using xmlrpclib. from xmlrpclib import ServerProxy baseurl = 'http://username:password@host.example.com:8080/' server = ServerProxy(baseurl + 'some/path') results = server.myFunction() # arguments as necessary Perhaps this is too simple, but it Just Works(tm). Bill -- INTERNET: bill@celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax: (206) 232-9186 Force always attracts men of low morality. -- Albert Einstein
Bill Campbell wrote:
On Tue, Feb 17, 2009, Rowan Woodhouse wrote:
Hi,
I'm having some trouble getting XML-RPC methods going on Zope2/Five. I've got the following in my configure.zcml:
<configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:five="http://namespaces.zope.org/five" xmlns:xmlrpc="http://namespaces.zope.org/xmlrpc">
<include package="zope.app.publisher.xmlrpc" file="meta.zcml" /> <include package="zope.app.security" file="meta.zcml" />
<xmlrpc:view for="MZCore.interface.IMZTag" methods="smeg" class="MZCore.MZTag.MZTag.MZTagXmlRpcInterface" permission="zope.Public" />
</configure>
...
But when I try to access the method via XML-RPC as follows (where aaa is and object that implements IMZTag)
I am probably using an older version of zope, but the following is working for me using xmlrpclib.
from xmlrpclib import ServerProxy baseurl = 'http://username:password@host.example.com:8080/' server = ServerProxy(baseurl + 'some/path') results = server.myFunction() # arguments as necessary
Perhaps this is too simple, but it Just Works(tm).
Bill
Thanks for the suggestion but that is what I'm doing at the moment when trying to access the method. I can access methods published through a Plone page on the same server instance without any problems. The problem seems to be that the XML-RPC method isn't being published or bound to the IMZTag interface for some reason. Rowan
Rowan Woodhouse wrote at 2009-2-17 21:36 +0000:
... I'm having some trouble getting XML-RPC methods going on Zope2/Five. I've got the following in my configure.zcml:
The Zope 3 xmlrpc implementation may not work with Zope2. Zope2' xmlrpc implementation is incredibly hard (and broken): it intercepts every "POST" request with content type "text/xml" and may interfere with the Zope 3 way to integrate xmlrpc. Maybe, you disable the "xmlrpc" integration code in "ZPublisher.HTTPRequest" and see whether than the Zope 3 integration works better. -- Dieter
participants (3)
-
Bill Campbell -
Dieter Maurer -
Rowan Woodhouse