我正在尝试将我的Perl-SOAP通信应用程序移植到一个Python等价物上,但似乎无法克服urllib2通过suds引发的这个错误。我的perl-soap脚本是:use myStub;
$ENV{HTTPS_PKCS12_FILE} = '/path/to/certificate';
$ENV{HTTPS_PKCS12_PASSWORD} = 'password';
my $client = new myStub;
my $output = $client->foo('test', 'something');
print $output
其中myStub是{}作为SOAP::Lite的一部分创建的.pm。在
我将python脚本设置如下:
^{pr2}$
这给了我:File "test.py", line 12, in
output = client.service.foo('test', 'something')
File "/usr/lib/python2.6/site-packages/suds/client.py", line 542, in __call__
return client.invoke(args, kwargs)
File "/usr/lib/python2.6/site-packages/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File "/usr/lib/python2.6/site-packages/suds/client.py", line 643, in send
reply = transport.send(request)
File "/usr/lib/python2.6/site-packages/suds/transport/https.py", line 64, in send
return HttpTransport.send(self, request)
File "/usr/lib/python2.6/site-packages/suds/transport/http.py", line 77, in send
fp = self.u2open(u2request)
File "/usr/lib/python2.6/site-packages/suds/transport/http.py", line 118, in u2open
return url.open(u2request, timeout=tm)
File "/usr/lib64/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib64/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib64/python2.6/urllib2.py", line 1198, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib64/python2.6/urllib2.py", line 1165, in do_open
raise URLError(err)
urllib2.URLError:
suds客户机创建得很好,如果我打印出来,就会得到所列出的预期方法等