[Zope] How do I form an XML-RPC query to a remote server?

Edward Muller edwardam@home.com
Thu, 16 Nov 2000 02:10:44 -0500 (EST)


On Wed, 15 Nov 2000, Tony McDonald wrote:

> Hi all,
> I'm experimenting with collating data from a remote database that uses
> XML-RPC.
> 
> I can send it messages like;
> >>> import xmlrpclib
> >>> medweb = xmlrpclib.Server("http://bogus.server.com")
> >>> medweb.getImages('scar')

That looks right...

> '<?xml version="1.0" encoding="ISO-8859-1"
> ?>\015\012\011<data>\015\012\011\011<title>Medwebb Images</title> \0
> 
> (lots of stuff snipped)
> 

That doesn't ... I don't think they have a well formed XML-RPC document, so
xmlrpclib can't parse it...

> But I just can't figure out how to send the XML version of the same query,
> ie

xmlrpclib handles the marshaling/un-marshaling to xml/from python for you...

> <?XML VERSION="1.0"?>
> <methodCall>
>     <methodName>getimages</methodName>
>     <params>
>         <param>
>             <value><string>scar</string></value>
>             </param>
>         </params>
>     </methodCall>
> 
> to the server.
> 

xmlrpc lib is already constructing this...or it should be,,,

> I've got a nasty feeling that when I get told how to do this, I'm going to
> slap my forehead bloody hard....

See above :-)

> 
> As you can see the data is returned in XML format, and whilst I'm fine with
> Python code for XML parsing (usually use sgmlop), I'm a bit lost on where to
> start here. An External Method seems the best way, but I'd like the received
> wisdom on this.

Again, See above...xmllib should handle all the marshaling from xml to python
data types for you...I'm not sure what it does in the case of an ill formed
document, it may jsut pass back the date to you, in this case the xml you are
recieveing...

> 
> Ta muchly,
> tone
> ------
> Dr Tony McDonald,  Assistant Director, FMCC, http://www.fmcc.org.uk/
> The Medical School, Newcastle University Tel: +44 191 222 5116
> A Zope list for UK HE/FE  http://www.fmcc.org.uk/mailman/listinfo/zope
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 

-- 
...EAM...
edwardam@home.com
edwardam@handhelds.org
-----------------------
'It's because crappy programs offend me.' --Eric Raymond