我想用 Zeep 解析一个 WSDL 文件并退出:
- 所有的操作
- 为每个操作请求 xml 消息
有关解析 wsdl 的任何示例?
我想我应该使用 zeep.wsdl 和 parse_service 方法?
/一个
我想用 Zeep 解析一个 WSDL 文件并退出:
有关解析 wsdl 的任何示例?
我想我应该使用 zeep.wsdl 和 parse_service 方法?
/一个
更新:
import operator
from zeep import Client
wsdl = 'http://www.soapclient.com/xml/soapresponder.wsdl'
client = Client(wsdl=wsdl)
for service in client.wsdl.services.values():
print "service:", service.name
for port in service.ports.values():
operations = sorted(
port.binding._operations.values(),
key=operator.attrgetter('name'))
for operation in operations:
print "method :", operation.name
print " input :", operation.input.signature()
print " output:", operation.output.signature()
print
print
解决了:
client= Client('url_to_wsdl')
for service in client.wsdl.services.values():
for port in service.ports.values():
operations = sorted(
port.binding._operations.values(),
key=operator.attrgetter('name'))
for operation in operations:
print operation.name
node = client.create_message(client.service, operation.name)
print node