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

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

1.针对非安全的http

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

打印结果:

{
'_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.html

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

猜你喜欢

转载自www.cnblogs.com/apff/p/10317540.html