[Tutor] parsing response from SOAPpy request

Dave Kuhlman dkuhlman at rexx.com
Sat Sep 1 20:09:51 CEST 2007


On Sat, Sep 01, 2007 at 10:24:24AM -0600, Eric Brunson wrote:
> Alan Gauld wrote:
> > "Sean Cronin" <seancron at gmail.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.
> >>     
> >
> > Thats right the string is the XML document, just as if you had read it
> > from a file with the read() method.
> >
> >   
> >> Does anyone have any suggestions on getting relevant data?
> >>     
> >
> > You need to parse the xml.
> >
> > The classic way to do that is using DOM or sax parsing,
> 
> Bleah.  ;-)

I don't understand this.  The response comes back as the value of a
function/method call.  You should not have to look at XML (text) at
all, unless something goes wrong and you need to do debugging. 
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.

Currently, I do not have SOAPpy installed.  But last time I used
it, I did not parse XML.

For an example, in the SOAPpy distribution, look at
tests/cardClient.py.  It makes SOAP requests, and receives the
responses to those requests, but it does not (directly) generate or
parse XML.  SOAPpy does that for you.

You have most likely already looked at those examples.  So, maybe
there is something that I don't understand about your question?

Dave



-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman


More information about the Tutor mailing list