Tuesday, June 24, 2008

Python web service client using soaplib

Here is an example of a python web service client using soaplib. I personally find the SOAPpy implementation better.
from soaplib.wsgi_soap import SimpleWSGISoapApp
from soaplib.service import soapmethod
from soaplib.serializers.primitive import String
from soaplib.client import make_service_client
class YYY(SimpleWSGISoapApp):
__tns__ = 'http://webservices.daehosting.com/ISBN'
@soapmethod(String,_returns=String,_outVariableName='IsValidISBN13Result')
def IsValidISBN13(self,sISBN):
pass
client = make_service_client('http://webservices.daehosting.com/services/isbnservice.wso?WSDL',YYY())
print client.IsValidISBN13('0000000000000')
print client.IsValidISBN13('9780061374227')

No comments: