我正在尝试使用 suds python 包发送一个肥皂请求,如下所示:
from suds.client import Client
WSDL_URL = 'file:/home/Documents/soap/getttt.wsdl'
client = Client(WSDL_URL, cache=None)
result = client.service.GET_TTT(H_ID="01",
TTT_ID="44825955",
VERSION_DATE="2010-12-01",
ACC="B9800B4930543BC4FB305124EDFF7846")
print result
它适用于带有 http uri 的简单 wsdl,但我需要使用文件协议加载这个 wsdl,这个 wsdl 要复杂得多。它像这样导入 xsd 文件:
<types>
<xsd:schema>
<xsd:import schemaLocation="GET_TTT.xsd" namespace="http://example.com"/>
<xsd:import schemaLocation="TTT_TABLES.xsd" namespace="http://example.com"/>
</xsd:schema>
</types>
它失败并显示此错误消息:
File "suds_client.py", line 17, in <module>
ACC="B9800B4930543BC4FB305124EDFF7846")
File "python2.7/site-packages/suds/client.py", line 542, in __call__
return client.invoke(args, kwargs)
File "python2.7/site-packages/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File "python2.7/site-packages/suds/client.py", line 637, in send
reply = transport.send(request)
File "python2.7/site-packages/suds/transport/https.py", line 64, in send
return HttpTransport.send(self, request)
File "python2.7/site-packages/suds/transport/http.py", line 77, in send
fp = self.u2open(u2request)
File "python2.7/site-packages/suds/transport/http.py", line 118, in u2open
return url.open(u2request, timeout=tm)
File "/usr/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>
任何想法如何调试这个?我需要使用 ImportDoctor 加载 xsd 文件还是自动加载它们?如果我这样做,那么如何加载所有 xsd 文件?我可以使用名为soapUI 的软件从该wsdl 发送请求。谢谢