Studying python/SOAP/WSDL

来源:互联网 发布:火牛抢购软件好吗 编辑:程序博客网 时间:2024/05/22 23:21
del.icio.us Tags: python,SOAP,jira

Setup python-suds on cygwin+WinXP

1. install python-setuptool, refer http://pypi.python.org/pypi/setuptools
* download package (*.egg)
* PATH=.:$PATH sh setuptools-0.6c11-py2.6.egg

2. install  python-suds, refer http://www.jansipke.nl/python-soap-client-with-suds
* python setup.py install

 

successful code sample

#!/usr/bin/env python
import suds
#url = "http://www.ecubicle.net/iptocountry.asmx?wsdl"
url = "http://localhost:8080/rpc/soap/jirasoapservice-v2?wsdl"
client = suds.client.Client(url)
auth = client.service.login('gitdev', 'asdefg')
#print client
#print client.service.getIssueById(auth,'HUDGITTEST-1')

filters = client.service.getFavouriteFilters(auth)
print filters

types = client.service.getIssueTypes(auth)
print types

issue = client.service.getIssue(auth, 'HUDGITTEST-1')
print issue

baseUrl=client.service.getServerInfo(auth)['baseUrl']
#newissue = client.service.createIssue(auth, {'project': 'HUDGITTEST', 'type': '1', 'summary': 'Issue created with Python!'})
#print newissue

client.service.addComment(auth, 'HUDGITTEST-1', {'body': 'Comment added with SOAP'})

client.service.logout(auth)

原创粉丝点击