Skip to content

Instantly share code, notes, and snippets.

@jclosure
Created April 7, 2015 07:52
Show Gist options
  • Select an option

  • Save jclosure/24d3bf21df7e8ba7775b to your computer and use it in GitHub Desktop.

Select an option

Save jclosure/24d3bf21df7e8ba7775b to your computer and use it in GitHub Desktop.
Consume a Soap Service in Python with suds
import logging
import traceback as tb
import suds.metrics as metrics
from suds import WebFault
from suds.client import Client
errors = 0
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.metrics').setLevel(logging.DEBUG)
logging.getLogger('suds').setLevel(logging.DEBUG)
def start(url):
global errors
print('\n________________________________________________________________\n')
print('Test @ ( %s ) %d' % (url, errors))
try:
url = "http://www.thomas-bayer.com/axis2/services/BLZService?wsdl"
start(url)
client = Client(url)
#print(client)
#client.setport(0)
response = client.service.getBank("76251020")
print(response)
except WebFault as f:
errors += 1
print(f)
print(f.fault)
except Exception as e:
errors += 1
print(e)
tb.print_exc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment