Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Users

Zope2 and XMLRPC methods

 

 

Zope users RSS feed   Index | Next | Previous | View Threaded


rwoodhouse at wirelessmeasurement

Feb 17, 2009, 1:36 PM

Post #1 of 4 (1309 views)
Permalink
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 [at] 192: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

_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


bill at celestial

Feb 17, 2009, 2:05 PM

Post #2 of 4 (1230 views)
Permalink
Re: Zope2 and XMLRPC methods [In reply to]

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 [at] host: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 [at] celestial 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
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


rwoodhouse at wirelessmeasurement

Feb 17, 2009, 2:11 PM

Post #3 of 4 (1229 views)
Permalink
Re: Zope2 and XMLRPC methods [In reply to]

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 [at] host: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

_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


dieter at handshake

Feb 21, 2009, 4:01 AM

Post #4 of 4 (1197 views)
Permalink
Re: Zope2 and XMLRPC methods [In reply to]

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
_______________________________________________
Zope maillist - Zope [at] zope
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Zope users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.