Created
April 7, 2015 07:52
-
-
Save jclosure/24d3bf21df7e8ba7775b to your computer and use it in GitHub Desktop.
Consume a Soap Service in Python with suds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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