I agree, in principle, with what Chris says. But I have had so many problems with suds, that I often just send/receive/parse raw XML.Basically, I:1. use soapUI to get raw XML request strings.2. create XML request string templates with %(paramName)s string replacement:xmlRequest = xmlRequestTemplate%{paramName:paramVal, ...}3. use the python "requests" module (http://docs.python-requests.org/en/latest/) to do the soap call:import requestsxmlResponse = requests.post(endpointURL, data=xmlRequest)4. use ElementTree (or substitute your favorite XML lib) to parse the response:import xml.etree.cElementTree as ETresponseRoot - ET.fromstring(xmlResponse)returnCode = int(responseRoot.find('.//statusBlock/returnCode').text.strip())That's just the bare bones. I've created some classes for requests, responses and exceptions that encapsulate those things, with some error handling, etc.
Obviously, this subverts all the fancy stuff in SOAP. But it also bypasses a lot of the headaches. It also lets me use Soap 1.2 :)I'm wondering if anyone else has thoughts on this approach.Thanks.-- JeffOn Mon, Sep 30, 2013 at 6:15 PM, Chris Sears <csears@gmail.com> wrote:
Hi David,What you describe is not how things are normally done with Suds. Usually the body is automatically created by Suds by invoking methods that are defined in the WSDL. If you control the SOAP server endpoint and wanted to pass arbitrary XML, you could always create a custom method (eg sendXML) with a string parameter for the XML body you wanted to send. It's a bit hacky, and you'd have to make sure things were properly encoded, but it would work.- ChrisOn Mon, Sep 30, 2013 at 4:16 PM, David Greco <David_Greco@harte-hanks.com> wrote:
_______________________________________________I am using Suds as a client. Trying to get it to simply call a service/method with a prebuilt XML string for the body (but let Suds handle the soap-specific enveloping). Is this doable? So far I accomplished it by manually adding the soap evenlope, header, and body tags around the xml. Is there a better way?
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds
_______________________________________________
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds
_______________________________________________
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds