Saturday, March 14, 2009

SOAPpy wsdl Security

I was working on SOAPpy to access the web service exposed by JasperServer (REALLY COOL STUFF). SOAPpy can automatically retrieve function definitions from WSDL as so:



from SOAPpy import WSDL

url = 'yoururl'

# just use the path to the wsdl of your choice
wsdlObject = WSDL.Proxy(url + '?wsdl')


print 'Available methods:'
for method in wsdlObject.methods.keys() :
print method
ci = wsdlObject.methods[method]
# you can also use ci.inparams
for param in ci.outparams :
# list of the function and type
# depending of the wsdl...
print param.name.ljust(20) , param.type
print






If you want SOAPpy to authenticate you should simply put url like :


'http://username:password@computerip_name'


etc. SOAPpy internally uses urllib. It should be able to handle that.

However SOAPpy cannot authenticate method calls. You can make it authentication aware by reading more about it here:

http://www.voidspace.org.uk/python/articles/authentication.shtml

Also, since only manually testing revealed this. SOAPpy (version : 0.12) does not handle soap attachments (you can't use it as it is with Jasper). Had to test it to find out. ZSI does.