suds脚本失败,异常异常:导入的模式失败,无法找到记录器“suds.xsd.sxbasic”的处理程序

时间:2012-01-24 14:02:15

标签: python soap suds

Python新手。 尝试使用Python构建一个简单的soap客户端。 相同的程序在不涉及代理的环境中工作。

***********Version 1
import suds
import urllib2
t = suds.transport.http.HttpTransport()
proxy = urllib2.ProxyHandler({'http': 'http://xxx.xxx.xxx.xxx:xx'})
opener = urllib2.build_opener(proxy)
t.urlopener = opener
ws = suds.client.Client('http://Server:13080/SM/7/ServiceDesk.wsdl', transport=t)
>>> 
No handlers could be found for logger "suds.xsd.sxbasic"
Traceback (most recent call last):
File "C:\localdisk\Python\testSoap.py", line 20, in <module>
ws = suds.client.Client('http://Server:13080/SM/7/ServiceDesk.wsdl', transport=t)
File "build\bdist.win32\egg\suds\client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "build\bdist.win32\egg\suds\reader.py", line 152, in open
d = self.fn(url, self.options)
File "build\bdist.win32\egg\suds\wsdl.py", line 159, in __init__
self.build_schema()
File "build\bdist.win32\egg\suds\wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "build\bdist.win32\egg\suds\xsd\schema.py", line 93, in load
child.open_imports(options)
File "build\bdist.win32\egg\suds\xsd\schema.py", line 305, in open_imports
imported = imp.open(options)
File "build\bdist.win32\egg\suds\xsd\sxbasic.py", line 542, in open
result = self.download(options)
File "build\bdist.win32\egg\suds\xsd\sxbasic.py", line 567, in download
raise Exception(msg)
Exception: imported schema (http://www.w3.org/2005/05/xmlmime) at (http://www.w3.org/2005/05/xmlmime), failed
>>> 


**********Version2*********
from suds.client import Client
from suds import WebFault
url = 'http://Server:13080/SM/7/ServiceDesk.wsdl'
userid = 'falcon'
passwd = ''
d = dict(http='http://xxx.xxx.xxx.xxx:xx')
client = Client(url, proxy=d)
print client
>>> 
No handlers could be found for logger "suds.xsd.sxbasic"
Traceback (most recent call last):
File "C:\localdisk\Python\smWSDL.py", line 24, in <module>
client = Client(url, proxy=d)
File "build\bdist.win32\egg\suds\client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "build\bdist.win32\egg\suds\reader.py", line 152, in open
d = self.fn(url, self.options)
File "build\bdist.win32\egg\suds\wsdl.py", line 159, in __init__
self.build_schema()
File "build\bdist.win32\egg\suds\wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "build\bdist.win32\egg\suds\xsd\schema.py", line 93, in load
child.open_imports(options)
File "build\bdist.win32\egg\suds\xsd\schema.py", line 305, in open_imports
imported = imp.open(options)
File "build\bdist.win32\egg\suds\xsd\sxbasic.py", line 542, in open
result = self.download(options)
File "build\bdist.win32\egg\suds\xsd\sxbasic.py", line 567, in download
raise Exception(msg)
Exception: imported schema (http://www.w3.org/2005/05/xmlmime) at (http://www.w3.org/2005/05/xmlmime), failed
>>> 
*********************************************************

我查看了@ https://fedorahosted.org/suds/wiki/Documentation的SUDS文档,无法收集太多 - 也许我忽略了一些东西。 非常感谢您的意见,谢谢。

1 个答案:

答案 0 :(得分:1)

我注意到在您指向的文档中,代理指定为:

{http:'host:port'}

{http:'http://host:port'}

可能是吗?