无法通过SOAPpy连接到wsdl

时间:2018-08-01 12:31:08

标签: python python-2.7 soap wsdl soappy

我正尝试连接到BRENDA以获得一些生物学信息,我按照其页面-link中的说明进行操作。 但是当我运行他们的代码时:

#!/usr/bin/python
import string
import hashlib
from SOAPpy import WSDL ## for extracting the URL of the endpoint (server script) from the WSDL file
from SOAPpy import SOAPProxy ## for usage without WSDL file

#1) Usage with WSDL (for extracting the URL of the endpoint)
wsdl = "http://www.brenda-enzymes.org/soap/brenda.wsdl"
password = hashlib.sha256("myPassword").hexdigest()
client = WSDL.Proxy(wsdl)
parameters = "j.doe@example.edu,"+password+",ecNumber*1.1.1.1#organism*Homo sapiens#"
resultString = client.getKmValue(parameters)
print resultString

#2) Usage without WSDL
endpointURL = "http://www.brenda-enzymes.org/soap/brenda_server.php"
password = hashlib.sha256("myPassword").hexdigest()
parameters = "j.doe@example.edu,"+password+",ecNumber*1.1.1.1#organism*Homo sapiens#"client = SOAPProxy(endpointURL)
resultString = client.getKmValue(parameters)
print resultString
在行中

-

client = WSDL.Proxy(wsdl)

我收到以下错误-

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pomicelltohar/venv/2_7/local/lib/python2.7/site-packages/SOAPpy/WSDL.py", line 85, in __init__
    self.wsdl = reader.loadFromString(str(wsdlsource))
  File "/home/pomicelltohar/venv/2_7/local/lib/python2.7/site-packages/wstools/WSDLTools.py", line 54, in loadFromString
    return self.loadFromStream(StringIO(data))
TypeError: initial_value must be unicode or None, not str

过去,我运行该代码,没有任何问题。 该代码在python 2.7上运行,我将密码更改为我的密码,但没有帮助。 试图找到其他有关此问题,但找不到任何问题。

0 个答案:

没有答案