当我尝试加载http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl
异常Type not found: '(IPAddressFilter, http://www.onvif.org/ver10/schema/onvif.xsd, )'
加注时。有可能解决吗?
from suds.client import Client
client = Client('file:///home/web/www/wsdl/devicemgmt.wsdl')
P.S。我更改了WSDL文件,只是添加了直接链接到文件开头的http://www.onvif.org/ver10/schema/onvif.xsd
。
P.P.S
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/suds/client.py", line 119, in __init__
sd = ServiceDefinition(self.wsdl, s)
File "/usr/local/lib/python2.7/dist-packages/suds/servicedefinition.py", line 58, in __init__
self.paramtypes()
File "/usr/local/lib/python2.7/dist-packages/suds/servicedefinition.py", line 137, in paramtypes
item = (pd[1], pd[1].resolve())
File "/usr/local/lib/python2.7/dist-packages/suds/xsd/sxbasic.py", line 63, in resolve
raise TypeNotFound(qref)
suds.TypeNotFound: Type not found: '(IPAddressFilter, http://www.onvif.org/ver10/schema/onvif.xsd, )'
答案 0 :(得分:0)
尝试添加要导入的架构。
from suds.client import Client
from suds.xsd.doctor import ImportDoctor
from suds.xsd.doctor import Import
imp = Import('http://www.w3.org/2001/XMLSchema') # the schema to import.
imp.filter.add('http://www.onvif.org/ver10/schema') # the schema to import into.
d = ImportDoctor(imp)
s = Client("http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl", doctor = d)