我有一个肥皂服务器进入HTTPS网站。信息以如下方式存储在XML中:
<web_service>
<host>XXXX.XXXX.com</host>
<port>43</port>
<user>superadmin</user>
<password>PASSWORD</password>
<url>https://XXXX.XXXX.com/ws_server.php?WSDL</url>
</web_service>
然后是我的python函数,它需要创建WS的Client:
import logging
logging.basicConfig(level=logging.INFO)
from suds import WebFault
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import
from suds.wsse import *
from suds.sax.attribute import Attribute
from suds.sax.element import Element
def get_wsclient(url, host, port, username, password):
tns = 'urn:MaarchSoapServer'
imp = Import('http://schemas.xmlsoap.org/soap/encoding/',)
imp.filter.add(tns)
client = None
try:
client = Client(url,plugins=[ImportDoctor(imp)], proxy={'https':host + ':' + port}, username=username, password=password, timeout=300)
client.options.cache.clear()
except WebFault as detail:
print "gw: ", detail
return client
但是问题是我有这样的错误消息:
httplib.BadStatusLine: ''
在this link之后,我尝试添加和例外并通过它,但是仍然存在问题。
NB:ws_server.php?WSDL可通过我的浏览器中的URL通过HTTPS访问