无法读取我的负载均衡器的SOAP API

时间:2014-09-05 05:36:41

标签: python api soap suds

我对SOAP非常陌生,我只是想让基础知识与#34; suds"一起使用。我正在运行以下代码:

import sys
from suds.client import Client
url='http://loadbalancer/wsdl/sys_service.wsdl'
client = Client(url)

如果我运行'打印客户端'在我的翻译中,我得到以下内容:

Suds ( https://fedorahosted.org/suds/ )  version: 0.4.1 (beta)  build: R705-20101207
Service ( AdcSysInfo ) tns="urn:webservicesapi"
Prefixes (1)
  ns0 = "urn:webservicesapi"
Ports (1):
  (AdcSysInfoSOAP)
     Methods (61):
    ....
    (many methods come back, truncated the output)
    getCPU()
    ....

我现在只想关注getCPU方法,所以我在我的解释器中运行这个语句:

example = client.service.getCPU()

但是我得到了以下输出:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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 414, in _open
'unknown_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 1223, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: urlprefix>

知道我做错了什么吗?谢谢。

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用https://pypi.python.org/pypi/suds-jurko

它可能比普通的泡沫更新。