回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>我使用脚本从计费系统获取信息(省略IP):</p>
<pre><code>from suds.client import Client
from netaddr import *
import logging
logging.basicConfig(filename='provisionSV.log',format='%(asctime)s %(levelname)s (message)s',level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
url = 'http://X.X.X.X:X/services/X?wsdl'
client = Client(url)
resultGet = client.service.getCustomerAllowancesRequestType_Search('myself', 100000000000000, 309999900000001)
</code></pre>
<p>在日志中我可以看到请求很好,我得到的响应是:</p>
^{pr2}$
<p>但我在应用程序中遇到一个sax解析异常:</p>
<pre><code>Traceback (most recent call last):
File "/usr/local/lib/python3.4/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/fciannel/python-project/autheudsessions/venv/lib/python3.4/site-packages/suds/client.py", line 521, in __call__
return client.invoke(args, kwargs)
File "/root/fciannel/python-project/autheudsessions/venv/lib/python3.4/site-packages/suds/client.py", line 581, in invoke
result = self.send(soapenv)
File "/root/fciannel/python-project/autheudsessions/venv/lib/python3.4/site-packages/suds/client.py", line 619, in send
description=tostr(e), original_soapenv=original_soapenv)
File "/root/fciannel/python-project/autheudsessions/venv/lib/python3.4/site-packages/suds/client.py", line 661, in process_reply
replyroot = _parse(reply)
File "/root/fciannel/python-project/autheudsessions/venv/lib/python3.4/site-packages/suds/client.py", line 832, in _parse
return Parser().parse(string=string)
File "/root/fciannel/python-project/autheudsessions/venv/lib/python3.4/site-packages/suds/sax/parser.py", line 133, in parse
sax.parse(source)
File "/usr/local/lib/python3.4/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/local/lib/python3.4/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/local/lib/python3.4/xml/sax/expatreader.py", line 211, in feed
self._err_handler.fatalError(exc)
File "/usr/local/lib/python3.4/xml/sax/handler.py", line 38, in fatalError
raise exception xml.sax._exceptions.SAXParseException:
<unknown>:1:0: syntax error
</code></pre>
<p>我得到的答案怎么了?在</p>