我在Python 2.7上有以下python程序,它使用python WDSL库。
>>> from SOAPpy import WSDL
>>> wsdlFile = 'my_wsdl_file_path'
>>> server = WSDL.Proxy(wsdlFile)
我得到以下错误;
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/SOAPpy/WSDL.py", line 62, in __init__
self.wsdl = reader.loadFromStream(stream, wsdlsource)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/WSDLTools.py", line 34, in loadFromStream
wsdl.load(document)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/WSDLTools.py", line 260, in load
schema = reader.loadFromNode(WSDLToolsAdapter(self), item)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 80, in loadFromNode
schema.load(reader)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1088, in load
self.addImportSchema(tp.getSchema())
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1205, in getSchema
self._schema = reader.loadFromURL(url)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 114, in loadFromURL
schema.load(reader)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1120, in load
tp.fromDom(node)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1764, in fromDom
self.setAttributes(node)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 627, in setAttributes
self.__checkAttributes()
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 681, in __checkAttributes
%(self.getItemTrace(), a, self.attributes[a])
SOAPpy.wstools.XMLSchema.SchemaError: <schema targetNamespace="http://tempuri.org/DataSetGW4.xsd"><element name="DataSetGW4">, unknown attribute(urn:schemas-microsoft-com:xml-msdata,{u'IsDataSet': u'true', u'UseCurrentLocale': u'true'})
可能是什么原因?
答案 0 :(得分:1)
我对SOAPpy的体验是它不像Suds那样完整和宽容。也许你应该尝试使用suds来解析你的WSDL文件。
import suds.client as client
session = client.Client('file:///absolute/path/to/yourwsdl')