第七篇:suds.TypeNotFound: Type not found: '(string, http://schemas.xmlsoap.org/soap/encoding/, )'

想要用Python的suds模块调用webservice地址作自动测试,可是找了不少方法都失败了,最终找到另一个模块能够做为客户端访问服务器地址。html

1.针对非安全的httppython

from zeep import Client
url = "http://***?wsdl"
from zeep import Client
client = Client(url)
result = client.service.getCircuit('11111') # getCircuit 为服务端提供的接口服务,能够调用,括号中传相应的参数
print(result)

打印结果:web

{
'_value_1': '{"errorMsg":"没有找到路由信息!"}',
'id': None,
'href': None,
'_attr_1': {
}
}安全

2.针对安全的https服务器

from requests import Session
from zeep import Client
from zeep.transports import Transport
url = "https://***?wsdl"
session = Session()    # 这里是由于url是https,否则不须要transport
session.verify = False
transport = Transport(session=session)
client = Client(url)
result = client.service.getCircuit('11111') # getCircuit 为服务端提供的接口服务,能够调用,括号中传相应的参数
print(result)

 关于zeep可参考:https://python-zeep.readthedocs.io/en/master/index.htmlsession

本文参考:https://blog.csdn.net/Ohmyberry/article/details/80430944?utm_source=blogxgwz4测试

相关文章
相关标签/搜索