[Tutor] parsing response from SOAPpy request

Alan Gauld alan.gauld at btinternet.com
Sun Sep 2 00:13:09 CEST 2007


"Dave Kuhlman" <dkuhlman at rexx.com> wrote

>> >> The response comes back as XML document but when I check it with
>> >> type(result) it shows the the response is a string.

> This is the point of using SOAPpy.  XML is the underlying (and
> mostly hidden) data representation that is sent "across the wire".
> But, you deal with Python and SOAPpy.  It translates your function
> calls into XML, sends it to a SOAP server, receives an (XML)
> response, and translates that XML response back into Python
> objects.

That's how it usually works where the return values are simple objects
like strings, integers, dates, even lists of things. But Web Services
are sometimes defined to return an XML document as the return object.
This is usually because the exact content is undefined or there is a 
lot
of it in complex structures. When that happens Python hands you a
string, which happens to be an XML document. The XML envelope that
surrounds the SOAP message is correctly stripped away by SOAPpy
but the string thats left is itself an XML document.

Its nothing to do with SOAPpy per se, any SOAP implementation
will do the same, it's what the web service returns.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list