所以我正在使用python中的应用程序的url进行基本的Web服务调用。我只是测试连接,看看Web服务是否响应。我的代码如下:
from suds.client import Client
client = Client("File:///C:/Users/zsssss/Documents/TrannsTubalService.wsdl")
print client
但是,我继续收到如下错误:
pydev debugger: starting
Traceback (most recent call last):
File "C:\Users\zsssss\AppData\Local\Aptana Studio 3\plugins\org.python.pydev_2.7.0.2013012902\pysrc\pydevd.py", line 1397, in <module>
debugger.run(setup['file'], None, None)
File "C:\Users\zsssss\AppData\Local\Aptana Studio 3\plugins\org.python.pydev_2.7.0.2013012902\pysrc\pydevd.py", line 1090, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "C:\Users\zsssss\My Documents\Aptana Studio 3 Workspace\sudsclient\src\transtube.py", line 7, in <module>
client = Client("File:///C:/Users/zn483d/Documents/TrannsTubalService.wsdl")
File "C:\Python27\lib\site-packages\suds\client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "C:\Python27\lib\site-packages\suds\reader.py", line 152, in open
d = self.fn(url, self.options)
File "C:\Python27\lib\site-packages\suds\wsdl.py", line 159, in __init__
self.build_schema()
File "C:\Python27\lib\site-packages\suds\wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "C:\Python27\lib\site-packages\suds\xsd\schema.py", line 93, in load
child.open_imports(options)
File "C:\Python27\lib\site-packages\suds\xsd\schema.py", line 305, in open_imports
imported = imp.open(options)
File "C:\Python27\lib\site-packages\suds\xsd\sxbasic.py", line 542, in open
result = self.download(options)
File "C:\Python27\lib\site-packages\suds\xsd\sxbasic.py", line 560, in download
d = reader.open(url)
File "C:\Python27\lib\site-packages\suds\reader.py", line 79, in open
d = self.download(url)
File "C:\Python27\lib\site-packages\suds\reader.py", line 95, in download
fp = self.options.transport.open(Request(url))
File "C:\Python27\lib\site-packages\suds\transport\https.py", line 60, in open
return HttpTransport.open(self, request)
File "C:\Python27\lib\site-packages\suds\transport\http.py", line 62, in open
return self.u2open(u2request)
File "C:\Python27\lib\site-packages\suds\transport\http.py", line 118, in u2open
return url.open(u2request, timeout=tm)
File "C:\Python27\Lib\urllib2.py", line 400, in open
response = self._open(req, data)
File "C:\Python27\Lib\urllib2.py", line 418, in _open
'_open', req)
File "C:\Python27\Lib\urllib2.py", line 378, in _call_chain
result = func(*args)
File "C:\Python27\Lib\urllib2.py", line 1310, in file_open
return self.open_local_file(req)
File "C:\Python27\Lib\urllib2.py", line 1350, in open_local_file
raise URLError(msg)
urllib2.URLError: <urlopen error [Error 2] The system cannot find the file specified: u'C:\\Users\\zsssss\\Documents\\TrannsTubalResponse.xsd'>
答案 0 :(得分:0)
有点老问题但有同样的问题。为此,我使用了pathlib:
import pathlib
filepath = '/var/www/yourwsdlfile.extension'
fileuri = pathlib.Path(filepath).as_uri()
client = Client(url=fileuri)
在Ubuntu上使用suds-jurko 0.6为我工作。我注意到我的文件库结束了 &#39;文件:///var/www/secureitemdelivery.asmx'