[Zope] ANN: Zope XML-RPC!

Robin Becker robin@jessikat.demon.co.uk
Sun, 20 Jun 1999 14:09:13 +0100


In article <5J8fxGAAJEb3Ewal@jessikat.demon.co.uk>, Robin Becker
<robin@jessikat.demon.co.uk> writes
>In article <19990619175850.S14374@moebius.dartmouth.edu>, Eric Kidd
><eric@userland.com> writes
>>On Sat, Jun 19, 1999 at 04:51:31PM +0100, Robin Becker wrote:
>>> xml_hello_world inside <ZOPEROOT>/Extensions/test.py and with my browser
>>> http://jessikat:9673/xml_hello_world?name=xxx returns the expected
>>> Hello, xxx!
>>
>>Looks good so far.
>> 
>>> when I run the xmlrpclib route as in
>>> 
>>> >>> import xmlrpclib
>>> >>> s=xmlrpclib.Server("http://jessikat:9673")
>>
>>Hmmm. You tripped over a strange default in xmlrpclib. You really meant to
>>write:
>>
>>  s=xmlrpclib.Server("http://jessikat:9673/") # Notice the final '/'
>>
>>If you omit the final '/', xmlrpclib defaults to the following URL:
>>
>>  http://jessikat:9673/RPC2
>agreed about xmlrpclib default, but sorry still bad
>>>> import xmlrpclib
>>>> s=xmlrpclib.Server("http://jessikat:9673/")
>>>> print s.xml_hello_world('aaa')
>Traceback (innermost last):
>  File "<pyshell#2>", line 1, in ?
>    print s.xml_hello_world('aaa')
>  File "C:\Python\Lib\xmlrpclib.py", line 457, in __call__
>    return self.__send(self.__name, args)
>  File "C:\Python\Lib\xmlrpclib.py", line 496, in __request
>    headers
>ProtocolError: <ProtocolError for jessikat:9673/: -1 Status: 200 OK
>>
>>>> 
>the external method still works and is available anonymously. I'm using
>Win95 could that have anything to do with it?
a bit more debugging reveals that with the corrected URL I'm getting
back to HTTPRequest at line 203 with the response body being
response.body=
<?xml version='1.0'?>
<methodResponse>
<params>
<param>
<value><string>Hello, aaa!</string></value>
</param>
</params>

</methodResponse>

ie the xml handling is working at that level and seems to go wrong after
the function call is made.
>>
>>This is because the XML-RPC methods on most servers are attached to a
>>top-level object named 'RPC2' (I have no clue why). Zope has no 'RPC2'
>>object, so this default is useless.
>>
>>> a bit of debugging reveals that the parse into method and args happens
>>> ok, but inside xmlrpc somewhere a fault is happening; it seems that the
>>> standard error return from Zope is shoved into the response body.
>>
>>Yes. The error-handling machinery in Zope 2.0 is due for an overhaul. I
>>won't improve the XML-RPC error reporting until everthing stops changing.
>>
>>If you have any more problems (or feedback), please don't hesitate to ask.
>>
>>Cheers,
>>Eric
>>
>>_______________________________________________
>>Zope maillist  -  Zope@zope.org
>>http://www.zope.org/mailman/listinfo/zope
>>
>>(For developer-specific issues, use the companion list,
>>zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>

-- 
Robin Becker