Guangyu Zhou
Guangyu Zhou

Reputation: 31

How to call to ASMX web services SOAP with Python3.6 SUDS

There is a simple code block which isn't working:

import suds
from suds.client import Client
url="http://XX.XX.XX.XX:yy/webservice.asmx"
client=suds.client.Client(url)

errors are following:

  "D:\Program Files\Python36\python.exe" D:/PycharmProjects/work/abc.py
Traceback (most recent call last):
File "D:\Program Files\Python36\lib\xml\sax\expatreader.py", line 210, in feed
self._parser.Parse(data, isFinal)
xml.parsers.expat.ExpatError: mismatched tag: line 180, column 16

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\abc.py", line 5, in <module>
client=suds.client.Client(url)
File "D:\Program Files\Python36\lib\site-packages\suds\client.py", line 115,   in __init__
self.wsdl = reader.open(url)
File "D:\Program Files\Python36\lib\site-packages\suds\reader.py", line 150, in open
d = self.fn(url, self.options)


.......

xml.sax._exceptions.SAXParseException: <unknown>:180:16: mismatched tag

Process finished with exit code 1


win 10

py3.6

Could anyone help me?thanks.

````

Upvotes: 0

Views: 4893

Answers (1)

Guangyu Zhou
Guangyu Zhou

Reputation: 31

Done, I used zeep while giving up suds, and then solved it myself

from zeep import Client
AOurl="http://xyz.asmx"
client = Client("http://xyz.asmx?WSDL")
f = open('2.xml','rt',encoding='GB2312')
s=f.read()
response=client.service.DEMO1(s)
print(response)
f.close()

Upvotes: 2

Related Questions