The old WebService calling methods described in dive into Python need the following packages: pyxml, fpconst, soappy
Basically, the above packages will not be maintained in or later, and most of them will not support python2.5 or later versions. Obviously, if we want to use these packages, it will be quite painful, on stackoverflow, someone asked the "best" Soap client in Python, and someone replied: click here to view details.
I carefully read the reply and finally chose suds.
Url = "http://example.com/test.asmx? WSDL "client = client (URL) # view the remote method print Client # simply call the client. service. hello () # Passing object parameters (method 1) # assume that I have made a class of the C-type, which has two attributes: P1 and P2. M = client. factory. create ('mysql') M. p1 = "my name is" M. p2 = "Walker" result = client. service. classin (m) print result # Pass object parameters (method 2) M = {"p1": "My name is", "p2 ": "Walker"} client = client (URL) Result = client. service. classin (m) print result # returned object result = client. service. classout () print result. p1 # visible returned objects can be directly used # demonstrate suds to package exceptions into a metagroup and send client = client (URL, faults = false) Result = client. service. classin ("fadlskfjsdafjk") print result