I want to parse a WSDL file with Zeep and get out:
- All the operations
- Request xml messages for each operations
Any examples on parsing the wsdl?
I guess I should use zeep.wsdl and the parse_service method?
/A
updated:
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
Andreas Blomqvist
solved:
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
来源:https://stackoverflow.com/questions/44885439/parse-wsdl-with-zeep