使用 Zeep 解析 WSDL
Parse WSDL with Zeep
我想用 Zeep 解析 WSDL 文件并退出:
- 所有操作
- 为每个操作请求 xml 条消息
有没有解析 wsdl 的例子?
我想我应该使用 zeep.wsdl 和 parse_service 方法?
/一个
已解决:
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
更新:
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
我想用 Zeep 解析 WSDL 文件并退出:
- 所有操作
- 为每个操作请求 xml 条消息
有没有解析 wsdl 的例子?
我想我应该使用 zeep.wsdl 和 parse_service 方法?
/一个
已解决:
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
更新:
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