python suds import 哪些,
发布网友
发布时间:2022-05-25 12:06
我来回答
共1个回答
热心网友
时间:2023-10-25 17:50
正在学习python,使用suds用soap client遇到问题,代码如下,不是所有WebServices都出错,有些是可以的。注释中的url即使可以成功的。
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import
url = "http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl"
#url = "http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl"
imp = Import('http://www.w3.org/2001/XMLSchema', location='http://www.w 3.org/2001/XMLSchema.xsd')
imp.filter.add('http://webservice.webxml.com.cn/WebServices/')
d = ImportDoctor(imp)
client = Client(url, doctor=d)
print client
错误信息
Traceback (most recent call last):
File "weather.py", line 14, in <mole>
client = Client(url, doctor=d)
File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/reader.py", line 152, in open
d = self.fn(url, self.options)
File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/wsdl.py", line 159, in __init__
self.build_schema()
File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/xsd/schema.py", line 95, in load
child.dereference()
File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/xsd/schema.py", line 323, in dereference
midx, deps = x.dependencies()
File "/usr/local/lib/python2.7/dist-packages/suds-0.4-py2.7.egg/suds/xsd/sxbasic.py", line 422, in dependencies
raise TypeNotFound(self.ref)
suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'