python suds.TypeNotFound:未找到类型:'(...,http://www.w3.org/2001/XMLSchema,)'

时间:2017-03-17 06:56:49

标签: python web-services soap wsdl suds

我正在尝试连接http://vipmember.tmtd.cpc.com.tw/CPCSTN/STNWebService.asmx?wsdl并使用以下代码:

from suds.client import Client  
from suds.xsd.doctor import Import, ImportDoctor
imp=Import('http://www.w3.org/2001/XMLSchema',location='http://www.w3.org/2001/  XMLSchema.xsd')
imp.filter.add('http://tmtd.cpc.com.tw/getCityStation')

url="http://vipmember.tmtd.cpc.com.tw/CPCSTN/STNWebService.asmx?wsdl"
client = Client(url,doctor=ImportDoctor(imp))

print(client)

但它会引发错误:

  File "D:\Program Files\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)

  File "D:\Program Files\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

  File "F:/Google 雲端硬碟/JD/cpc_station.py", line 17, in <module>
client = Client(url,doctor=ImportDoctor(imp))

  File "D:\Program Files\Anaconda3\lib\site-packages\suds\client.py", line 115, in __init__
    self.wsdl = reader.open(url)

  File "D:\Program Files\Anaconda3\lib\site-packages\suds\reader.py", line 150, in open
d = self.fn(url, self.options)

  File "D:\Program Files\Anaconda3\lib\site-packages\suds\wsdl.py", line 159, in __init__
    self.build_schema()

  File "D:\Program Files\Anaconda3\lib\site-packages\suds\wsdl.py", line 220, in build_schema
    self.schema = container.load(self.options)

  File "D:\Program Files\Anaconda3\lib\site-packages\suds\xsd\schema.py", line 94, in load
    child.dereference()

  File "D:\Program Files\Anaconda3\lib\site-packages\suds\xsd\schema.py", line 319, in dereference
    midx, deps = x.dependencies()

  File "D:\Program Files\Anaconda3\lib\site-packages\suds\xsd\sxbasic.py", line 437, in dependencies
    e = self.__deref()

  File "D:\Program Files\Anaconda3\lib\site-packages\suds\xsd\sxbasic.py", line 483, in __deref
    raise TypeNotFound(self.ref)

TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'

这两个(或两个)中的一个可能是问题吗? 提前感谢任何提示。

0 个答案:

没有答案