Python ->
Python script for testing (SOAP) web service using "suds" module

For creating SOAP client this python script uses SUDS module that can be downloaded here: https://pypi.python.org/pypi/suds or by using pip installer command: "pip install suds". Except this i am fascinated with how short and efficient python code can be for executing request for web-services, getting and parsing results. Web service for testing retrieves the names of German cities starting with a specific string (prefix). Its landing page: http://mathertel.de/AJAXEngine/S02_AJAXCoreSamples/OrteLookup.asmx

#!/usr/bin/env python

"""
For creating SOAP client this script uses SUDS module that
can be downloaded here: https://pypi.python.org/pypi/suds
or by using pip installer command: "pip install suds"
"""

import suds


def main():
   # main begin

   search_prefix = 'Freib' # test prefix
   wsdl = "http://mathertel.de/AJAXEngine/S02_AJAXCoreSamples/OrteLookup.asmx?WSDL"
   # using [suds]
   client = suds.client.Client(wsdl)
   response = client.service.OrteStartWith(prefix=search_prefix)

   print ('')
   print ('Retrieve the names of German cities starting with a given prefix:')
   print (wsdl)
   print ('test prefix: {}'.format(search_prefix))

   print ('------------------------------------')
   # print response
   print (response)
   print ('------------------------------------')

   # main end


if __name__ == "__main__": main()


Results in output console:
C:\Python27\python.exe C:/projects/web_services/german_cities.py

Retrieve the names of German cities starting with a given prefix:
http://mathertel.de/AJAXEngine/S02_AJAXCoreSamples/OrteLookup.asmx?WSDL
test prefix: Freib
------------------------------------
Freiberg am Neckar;Freiberg, Sachs;Freiburg (Elbe);Freiburg im Breisgau
------------------------------------

Process finished with exit code 0



sqlexamples.info