首页 > 其他 > 详细

suds 调用 Ladon示例中的服务

时间:2015-11-16 06:12:08      阅读:321      评论:0      收藏:0      [点我收藏+]

ladon-0.9.35 在生成描述时 将参数 search_frase 转成了 search-frase,这导致在客户端suds调用时命名参数不可用。。应该是个bug

<element name="listBands">
<complexType>
<sequence>
<element name="search-frase" type="xsd:string"/>
</sequence>
</complexType>
</element>
# -*- coding: utf-8 -*-

‘‘‘

‘‘‘
base_url =  ‘http://localhost:8088/‘
url = base_url +‘Calculator/soap/description‘
## 使用 SUDS调用 Ladon服务 
from suds.client import Client as SudsClient
client = SudsClient(url=url, cache=None)
result = client.service.add(a=23,b=45)
print(result )

def testAlbumService():

    print("\n\nTesting AlbumService:\n")
    # Load the AlbumService description
    album_client = SudsClient(base_url + ‘/AlbumService/soap/description‘)

    # Fetch albums containing the substring "Zoo" in the album title
    jsonwsp_resp = album_client.service.listAlbums(‘Bowie‘) #search_frase=
    print (jsonwsp_resp)

    # Fetch all bands containing the substring "Bowie" in the band name
    jsonwsp_resp = album_client.service.listBands(‘Bowie‘) #search_frase=
    print (jsonwsp_resp)


testAlbumService()
print ( "xx")


suds 调用 Ladon示例中的服务

原文:http://my.oschina.net/cppblog/blog/530664

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!