首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Zeep解析WSDL

用Zeep解析WSDL
EN

Stack Overflow用户
提问于 2017-07-03 12:20:30
回答 2查看 8.1K关注 0票数 3

我想用Zeep解析一个WSDL文件,然后退出:

  • 所有的行动
  • 为每个操作请求xml消息

有关于分析wsdl的示例吗?

我想我应该使用zeep.wsdl和parse_service方法?

/A

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2017-07-04 08:32:05

已解决:

代码语言:javascript
复制
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
票数 4
EN

Stack Overflow用户

发布于 2017-09-14 03:06:08

更新:

代码语言:javascript
复制
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
票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44885439

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档