[Zope-dev] Zope XML-RPC with SQL Methods

Michel Pelletier michel@digicool.com
Wed, 23 Jun 1999 10:25:37 -0400


> -----Original Message-----
> From: David White [mailto:davew@ed.ray.com]
> Sent: Wednesday, June 23, 1999 9:28 AM
> To: zope-dev@zope.org
> Subject: [Zope-dev] Zope XML-RPC with SQL Methods
> 
> 
> Hi All,
> 
> I've been playing around a bit with the recently added XML-RPC support
> for Zope, graciously added by Eric Kidd ( Thank you Eric! ) 
> and have been
> able to create External Methods and access them remotely from two
> different XML-RPC clients ( xmlrpclib in Python and 
> Frontier::Client in
> Perl).
> This is all VERY cool!
> 
> I was then wondering if it would be possible to directly call 
> a SQL Method
> from the client and get results ( ok maybe I was reaching too 
> far too quick,
> but what the heck I gave it a shot...).  This of course did 
> not work.  I
> tried
> a variety of different SQL methods (all selects ranging from 
> returning single
> result
> record to returning multiple record sets).  It seems as 
> though SQL Methods
> are
> not directly callable from the web, but rather must be referenced from
> another
> DTML method/document.  When I do try to directly call a SQL 
> Method from the
> web it always tries to take me to the 'manage_TestForm' for 
> the method.   It
> seems
> that 'index_html' always redirects there.

This is the intended behavior (lib/python/Shared/DC/ZRDB/DA.py line
312):

    def index_html(self, URL1):
        " "
        raise 'Redirect', ("%s/manage_testForm" % URL1)


(notice our verbose doc strings ;)

> 
> Is there some deep level of Zen for why this must be the 
> case?  Are there
> security implications if SQL Methods were directly callable?  
> It seems to me
> that to be able to do:
> 
> import xmlrpclib
> s = xmlrpclib.Server("http://somemachine.domain/")
> result_records = s.method_folder.some_sql_method()
> 

This is what I would expect too.  I don't want to jump the gun, but I
suspect that the XML-RPC code is using REQUEST.traverse to resolve
objects, and traverse will try and get a default index_html method for
objects.  XML_RPC needs to call the object directly, meaning the
__call__ method of the SQL object needs to be called directly.

If it is the case that XML-RPC uses REQUEST.traverse, you might want to
look into REQUEST.resolve_url().

However, I could be wrong.

-Michel

> would be just WAY TOO COOL!  What would it take to make SQL 
> methods directly
> callable from XML-RPC?  Am I just missing something? (very 
> possible :^)
> 
> Thanks in advance,
> 
> Dave
> 
> --
> ----------------------------------------------------
> David R. White          Raytheon Electronic Systems
> Process Support                      (508) 440-2087
> 528 Boston Post Rd.
> Sudbury, MA 01776
> davew@ed.ray.com
> ----------------------------------------------------
> 
> 
> 
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://www.zope.org/mailman/listinfo/zope-dev
> 
> (For non-developer, user-level issues, use the companion list,
> zope@zope.org, http://www.zope.org/mailman/listinfo/zope )
>