Ismar Sehic wrote at 2013-9-20 16:02 +0200:
>i'm probably very annoying and boring with these python web service :)and
>sorry for the previous message reply subject,wont happen again...
>the thing is, i'm provided with some service provider documentation,
>including xml request example, xml response example, wsdl file for the
>protocol defintion, and xsd file for every request type.
>i've played around with LXML and SUDS, and i got this :
If you are using "suds", you usually do not use "lxml" (at least not
for the parsing and construction of the SOAP messages).
Instead, you create a "suds" client (as you have done in the code
you have posted (and which I did not cite).
The suds client has a "factory" method. It allows you to create Python objects
corresponding to the types used by the webservice. You can populate
those objects by assigning values to its attributes. Usually
"print obj" shows you which attributes may be relevant.
In addition, the suds client has an attribute "service".
And this service object has as methods all the methods supported
by the webservice.
In a simple case, using "suds" looks like this:
from suds.client import Client
c = Client(<wsdl-url>)
print c.service.<method>(...) # this calls the webservice's <method> with the
provided arguments)
In more complicated cases (when the method arguments have a complex type),
it looks like this:
from suds.client import Client
c = Client(<wsdl-url>)
obj = c.factory("<type>")
obj.<attr> = <val>
....
print c.service.<method>(..., obj, ...)
--
Dieter
_______________________________________________
Soap mailing list
[email protected]
https://mail.python.org/mailman/listinfo/soap