On May 13, 1:02 pm, Jennifer Duerr <[EMAIL PROTECTED]> wrote: > All, > > I need help concerning SOAP, Python and XML. I am very new to this, so > dumbing it down for me will not offend me! > > I'm using Python and want to send a user-inputted string to an > existing Java web app that > will output results to XML. I need to capture elements of the XML and > put > the info into a table. (say I send a single/simple address string to > this > webservice/geocode, which then returns numerous possible matches with > XY > values and score values, and I want to capture that into a table) > > How do I go about doing this? I'm told I need to use SOAP. I > discovered that > the best module to use is ZSI (please correct me if I'm wrong). I have > installed the necessary module. Examples I have seen are plenty and > all so different, its not clear to me how to go about. I have been > spinning my wheels for too long on this! > > Can someone provide some example code similar to what I need to do? Or > any > guidance would be appreciated. > > Thanks!
It looks like you have three tasks here: - get data - parse it - store it SOAP could be the means to accomplish only the first one. If the service you use exposes the functionality using XML-RPC or some REST-ful methods I would try them first. If it does not, then you are stuck with SOAP. Using SOAP in Python is currently not as straightforward as it could be. You have chosen to use ZSI and that is fine choice. In documentation look for "wsdl2py". Given a URL to a WSDL file it will generate stub class definition with methods corresponding to the SOAP service methods. In your code you would instantiate the class, call the method you want and grab the payload. Your first task is done. >From what I understand the payload will be XML that will need to be parsed. For that you could use the excellent ElementTree If I were you I would investigate suds (https://fedorahosted.org/suds) It promises to be easier to use than ZSI. The README has the usage example. Waldemar -- http://mail.python.org/mailman/listinfo/python-list