Hello! As some of you may have guessed, I've finally gotten around to implementing XML-RPC for Zope. You can thank the following people: * Jim Fulton of Digital Creations, for adding XML-RPC hooks to ZPublisher and answering my stupid questions. * Fredrik Lundh of PythonWare, for his excellent Python XML-RPC module. * Dave Winer of UserLand Software, who wrote the XML-RPC spec (and who pays my salary). Please give all your thanks to these folks; they really *did* do all of the work. However, I may have plugged their components together incorrectly, so send all the blame and hate mail to me. :-) What is XML-RPC? ---------------- XML-RPC is a very simple RPC protocol that runs over HTTP. The function name and arguments are encoded as XML. XML-RPC isn't the fastest way to call a function on remote server, but it might be one of the easier to understand. (See http://www.xmlrpc.com/ for details.) An XML-RPC request looks like this: POST /z2/ 1.0 Content-Type: text/xml Content-Length: 170 <?xml version='1.0'?> <methodCall> <methodName>test.string_length</methodName> <params> <param> <value><string>foo</string></value> </param> </params> </methodCall> The response looks like this: HTTP/1.1 200 OK Content-Length: 122 Content-Type: text/xml <?xml version='1.0'?> <methodResponse> <params> <param> <value><int>3</int></value> </param> </params> </methodResponse> Fredrik Lundh of PythonWare wrote a very nice XML-RPC library for Python. (See http://www.pythonware.com/products/xmlrpc/ to get a copy.) Using his code, I could call the above function as:
import xmlrpclib s = xmlrpclib.Server("http://localhost/z2/") s.test.string_length("foo") 3
In other words, XML-RPC lets you treat a remote Zope object almost like a local Python object. Think of it as a super-simple cousin to CORBA and DCOM, and you'll get the right idea. XML-RPC for Zope ---------------- Thanks to all the aforementioned people, you can now use Zope as an XML-RPC server. It's easy. Here's the source code for 'test.string_length', which is loaded into Zope as an ordinary external method: def string_length(string): return len(string) See what I meant by "easy"? To use XML-RPC for Zope, you'll need to get the latest version of Zope from CVS and read the release notes on UserLand's site: http://linux.userland.com/stories/storyReader$18 Future Directions ----------------- Zope XML-RPC still has a few rough edges. If you discover any bugs which aren't mentioned on the site, or have any ideas for improvement, drop me a line. Thank you to all the people who helped out! Cheers, Eric
On Thu, 17 Jun 1999, Eric Kidd wrote:
Hello! As some of you may have guessed, I've finally gotten around to implementing XML-RPC for Zope.
Wow! I'm not going to even think about the security implications right now. Just WowWowWow!
On Thu, Jun 17, 1999 at 02:45:16PM -0700, Patrick Phalen wrote:
On Thu, 17 Jun 1999, Eric Kidd wrote:
Hello! As some of you may have guessed, I've finally gotten around to implementing XML-RPC for Zope.
Wow!
Thanks!
I'm not going to even think about the security implications right now.
XML-RPC uses standard Zope security. You can't access anything with XML-RPC that you couldn't access via the web (in theory, at least). Just think of this as an easy way to connect your Python (and Tcl and Perl etc.) scripts with Zope. It's not meant for high-performance RPC calls or massively complex distributed object models. Our first release of XML-RPC for Zope is a little bit naive. It doesn't handle exceptions very gracefully, and it needs some polishing. However, it should be good enough to try out. If something seems bogus, send me mail. :-) Cheers, Eric
Check out this URL: http://discuss.userland.com/msgReader$7305 Dang, you guys at DC are sure close-mouthed about this stuff... :^) 01 (my two bits), Michael Bernstein. PS. When will we have an RSS/OCS product for Zope? Huh? HUH? (just kidding, I know you're busy).
(I don't officially speak for UserLand in this message.) On Thu, Jun 17, 1999 at 04:34:50PM -0700, Michael Bernstein wrote:
Dang, you guys at DC are sure close-mouthed about this stuff... :^)
That's because we didn't exactly tell them. ;-) We're feeling things out as we go along, and sometimes little bits of information are released in advance. Dave Winer at UserLand will make a more formal announcement once he talks with Paul Everitt some more. We like Linux. We like dynamic websites. Zope runs on Linux and produces nifty dynamic websites. By a process of logical induction, you could conclude that we probably like Zope. We do. Now, we also sell a product which competes with Zope. It's called Frontier; it does many of the same things, and it runs on Windows NT and the MacOS. But Frontier and Zope are both "glue" products--they're valuable because they let you connect lots of things together. So even though we compete with Zope, we want to talk to it, too. Make sense? We're trying to be good citizens, too--we've submitted our patches to Digital Creations for use in a future version of Zope. If you want to know more, watch <http://www.scripting.com/> for future updates.
PS. When will we have an RSS/OCS product for Zope? Huh? HUH? (just kidding, I know you're busy).
If you write one, we'll be happy to feature it on our web site (as will DC, I imagine). But you could have figured that out on your own. :-) Cheers, Eric
Eric Kidd wrote:
(I don't officially speak for UserLand in this message.)
On Thu, Jun 17, 1999 at 04:34:50PM -0700, Michael Bernstein wrote:
Dang, you guys at DC are sure close-mouthed about this stuff... :^)
That's because we didn't exactly tell them. ;-) We're feeling things out as we go along, and sometimes little bits of information are released in advance. Dave Winer at UserLand will make a more formal announcement once he talks with Paul Everitt some more.
And here it is: http://discuss.userland.com/msgReader$7554 Coopetition rules! Michael Bernstein.
In article <19990617164927.B14374@moebius.dartmouth.edu>, Eric Kidd <eric@userland.com> writes
Hello! As some of you may have guessed, I've finally gotten around to implementing XML-RPC for Zope. You can thank the following people: ... I'm having a problem getting xml-rpc to go. I have installed cvs version of Zope2 and can see that the xml-rpc hooks are there. I got the latest xmlrpclib and xmlrpc.
I installed an external function 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! when I run the xmlrpclib route as in
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/RPC2: -1 Status: 200 OK
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. -- Robin Becker
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 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
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?
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
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
On Sun, Jun 20, 1999 at 02:09:13PM +0100, Robin Becker wrote:
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 looks like a good response. But you definitely shouldn't be seeing a fully formed response on line 203 of HTTPRequest: 202:meth, self.args = xmlrpc.parse_input(fs.value) 203:response=xmlrpc.response(response) At this point, the response object has just been created. You shouldn't be getting a valid response body until the object has been published, which requires making it back out to line 256 of Publish: 255:response=request.response # could have changed! 256:response = publish(request, module_name, after_list, debug=debug) Or am I missing something really obvious? Cheers, Eric
In article <19990620100249.W14374@moebius.dartmouth.edu>, Eric Kidd <eric.kidd@pobox.com> writes
On Sun, Jun 20, 1999 at 02:09:13PM +0100, Robin Becker wrote:
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 looks like a good response. But you definitely shouldn't be seeing a fully formed response on line 203 of HTTPRequest:
202:meth, self.args = xmlrpc.parse_input(fs.value) 203:response=xmlrpc.response(response) as far as I can tell this is the only place where HTTPRequest interacts with XML-RPC so it appears correct that the body should have happened here. I don't seem to have the same code as you so maybe that's the problem.
At this point, the response object has just been created. You shouldn't be getting a valid response body until the object has been published, which requires making it back out to line 256 of Publish:
255:response=request.response # could have changed! 256:response = publish(request, module_name, after_list, debug=debug)
Or am I missing something really obvious?
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
On Sun, Jun 20, 1999 at 05:14:05PM +0100, Robin Becker wrote:
as far as I can tell this is the only place where HTTPRequest interacts with XML-RPC so it appears correct that the body should have happened here. I don't seem to have the same code as you so maybe that's the problem.
Try Zope 2.0a3, which includes the necessary XML-RPC code as part of the standard distribution. I've just finished testing this on a Linux box (from a fresh install, using ZServer) and it seems to work fine. For those of you who are into XML-RPC, I'll have some new tools later this week. I've got some really neat demos which I'll post to <http://linux.userland.com/> in the future. Cheers, Eric
In article <19990621212806.O14374@moebius.dartmouth.edu>, Eric Kidd <eric.kidd@pobox.com> writes
On Sun, Jun 20, 1999 at 05:14:05PM +0100, Robin Becker wrote:
as far as I can tell this is the only place where HTTPRequest interacts with XML-RPC so it appears correct that the body should have happened here. I don't seem to have the same code as you so maybe that's the problem.
Try Zope 2.0a3, which includes the necessary XML-RPC code as part of the standard distribution. I've just finished testing this on a Linux box (from a fresh install, using ZServer) and it seems to work fine. I updated via cvs and it now works. Thanks.
For those of you who are into XML-RPC, I'll have some new tools later this week. I've got some really neat demos which I'll post to <http://linux.userland.com/> in the future.
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
On Tue, Jun 22, 1999 at 03:01:30PM +0100, Robin Becker wrote:
I updated via cvs and it now works. Thanks.
Great! Tell me if you encounter any other problems. Cheers, Eric P.S. In future messages, could you please quote a little less text? I have to look for your replies buried in a copy of my original message. :-) Thank you!
At 03:28 22/06/99 , Eric Kidd wrote:
Try Zope 2.0a3, which includes the necessary XML-RPC code as part of the standard distribution. I've just finished testing this on a Linux box (from a fresh install, using ZServer) and it seems to work fine.
For those of you who are into XML-RPC, I'll have some new tools later this week. I've got some really neat demos which I'll post to <http://linux.userland.com/> in the future.
I saw that the CVS version still uses xmlrpclib.py version 0.9.5. Version 0.9.8 is out, and has some bug fixes, speed improvements and support pluggable XML parsers: # 1999-02-10 fl Fixed problem with empty responses (from Skip Montanaro) # 1999-06-20 fl Speed improvements, pluggable XML parsers and HTTP transports Maybe you and DC should update to that version. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
participants (6)
-
Eric Kidd -
Eric Kidd -
Martijn Pieters -
Michael Bernstein -
Patrick Phalen -
Robin Becker