簡體   English   中英

使用Python和suds 0.4的SAXParseException?

[英]SAXParseException using Python and suds 0.4?

我有一個簡單的Python腳本,它使用Suds從SOAP Web服務中提取數據。 它在一台機器上完美運行,但當我將它移動到另一台具有較舊版本的Python(2.4.3)時,我得到以下堆棧跟蹤:

>>> client = suds.client.Client(url, username='xxx', password='xxx', location=service_location, cache=None)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/etlsmart/lib/python2.4/site-packages/suds/client.py", line 112, in __init__
    self.wsdl = reader.open(url)
File "build/bdist.linux-i686/egg/suds/reader.py", line 152, in open
File "build/bdist.linux-i686/egg/suds/wsdl.py", line 136, in __init__
File "build/bdist.linux-i686/egg/suds/reader.py", line 79, in open
File "build/bdist.linux-i686/egg/suds/reader.py", line 101, in download
File "/home/etlsmart/lib/python2.4/site-packages/suds/sax/parser.py", line 136, in parse
    sax.parse(source)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
    xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 220, in feed
    self._err_handler.fatalError(exc)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/handler.py", line 38, in fatalError
    raise exception
xml.sax._exceptions.SAXParseException: <unknown>:18:2: mismatched tag

我查看了涉及緩存的各種相關錯誤,但這似乎不是問題。 我已禁用緩存,而/ tmp / suds在任何情況下都只包含一個版本文件。

這可能與Python版本有關,還是有其他明顯的東西我應該嘗試?

我有同樣的問題。 服務器已回答HTML而不是SOAP。

端點使用錯誤的HTML消息進行響應,而不是SOAP XML。 出於某種原因,SUDS說“我無法解析這個。哼!” 而不是“我無法解析這個答案:<answer here>”,即使使用DEBUG日志級別也是如此。

發現使用調試器進入suds.reader:

/usr/lib/python2.6/site-packages/suds/reader.py in download(self, url)
    100         content = ctx.document
    101         sax = Parser()
--> 102         return sax.parse(string=content)
    103 
    104     def cache(self):

查看content並查看它是否為SOAP XML。

祝好運。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM