python soap client 使用 suds 错误: suds.TypeNotFound: Type not found
伊谢尔伦
伊谢尔伦 2017-04-17 11:05:38
0
0
2720

正在学习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 <module>
    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, )'

貌似是wsdl中有错误,有什么办法?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回覆(0)
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!