| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import sys |
| sys.path.append('../../') |
|
|
| from suds import * |
| from suds.client import Client |
|
|
| from datetime import datetime |
|
|
|
|
| errors = 0 |
| url = 'http://localhost:8080/axis2/services/BasicService?wsdl' |
| print('url=%s' % (url,)) |
|
|
| |
| |
| |
| client = Client(url) |
|
|
| |
| |
| |
| print(client) |
|
|
| print('printList()') |
| print(client.service.printList(['a', 'b'])) |
|
|
| |
| |
| |
| print('create name') |
| name = client.factory.create('ns2:Name') |
| name.first = u'jeff'+chr(1234) |
| name.last = 'ortel' |
|
|
| print(name) |
|
|
| |
| |
| |
| print('create phone') |
| phoneA = client.factory.create('ns2:Phone') |
| phoneA.npa = 410 |
| phoneA.nxx = 822 |
| phoneA.number = 5138 |
|
|
| phoneB = client.factory.create('ns2:Phone') |
| phoneB.npa = 919 |
| phoneB.nxx = 606 |
| phoneB.number = 4406 |
|
|
| |
| |
| |
| dog = client.factory.create('ns2:Dog') |
| print(dog) |
| dog.name = 'Chance' |
| dog.trained = True |
| print(dog) |
|
|
| |
| |
| |
| person = client.factory.create('ns2:Person') |
|
|
| |
| |
| |
| print('{empty} person=\n%s' % (person,)) |
|
|
| person.name = name |
| person.age = None |
| person.birthday = datetime.now() |
| person.phone.append(phoneA) |
| person.phone.append(phoneB) |
| person.pets.append(dog) |
|
|
| |
| |
| |
| print('person=\n%s' % (person,)) |
|
|
| |
| |
| |
| print('addPersion()') |
| result = client.service.addPerson(person) |
| print('\nreply(\n%s\n)\n' % (result.encode('utf-8'),)) |
|
|
| |
| |
| |
| newname = client.factory.create('ns2:Name') |
| newname.first = 'Todd' |
| newname.last = None |
|
|
| |
| |
| |
| print('updatePersion()') |
| result = client.service.updatePerson(person, newname) |
| print('\nreply(\n%s\n)\n' % (str(result),)) |
| result = client.service.updatePerson(person, None) |
| print('\nreply(\n%s\n)\n' % (str(result),)) |
|
|
|
|
| |
| |
| |
| print('echo()') |
| client.service.echo(None) |
| result = client.service.echo('this is cool') |
| print('\nreply( %s )\n' % (str(result),)) |
|
|
| print('echo() with {none}') |
| result = client.service.echo(None) |
| print('\nreply( %s )\n' % (str(result),)) |
|
|
| |
| |
| |
| print('hello()') |
| result = client.service.hello() |
| print('\nreply( %s )\n' % (str(result),)) |
|
|
| |
| |
| |
| try: |
| print('getVoid()') |
| result = client.service.getVoid() |
| print('\nreply( %s )\n' % (str(result),)) |
| except (KeyboardInterrupt, SystemExit): |
| raise |
| except Exception: |
| print(sys.exc_info()[1]) |
|
|
| |
| |
| |
| print('getList(list)') |
| mylist = ['my', 'dog', 'likes', 'steak'] |
| result = client.service.printList(mylist) |
| print('\nreply( %s )\n' % (str(result),)) |
| |
| print('testListArgs(tuple)') |
| mylist = ('my', 'dog', 'likes', 'steak') |
| result = client.service.printList(mylist) |
| print('\nreply( %s )\n' % (str(result),)) |
|
|
| |
| |
| |
| for n in range(0, 3): |
| print('getList(str, %d)' % (n,)) |
| result = client.service.getList('hello', n) |
| print('\nreply( %s )\n' % (str(result),)) |
| assert ( isinstance(result, list) and len(result) == n ) |
|
|
| print('addPet()') |
| dog = client.factory.create('ns2:Dog') |
| dog.name = 'Chance' |
| dog.trained = True |
| print(dog) |
| try: |
| result = client.service.addPet(person, dog) |
| print('\nreply( %s )\n' % (str(result),)) |
| except (KeyboardInterrupt, SystemExit): |
| raise |
| except Exception: |
| print(sys.exc_info()[1]) |
|
|
| print('___________________ E X C E P T I O N S __________________________') |
|
|
| |
| |
| |
| try: |
| print('throwException() faults=True') |
| result = client.service.throwException() |
| print('\nreply( %s )\n' % (tostr(result),)) |
| except (KeyboardInterrupt, SystemExit): |
| raise |
| except Exception: |
| print(sys.exc_info()[1]) |
|
|
| |
| |
| |
| try: |
| print('throwException() faults=False') |
| client.set_options(faults=False) |
| result = client.service.throwException() |
| print('\nreply( %s )\n' % (tostr(result),)) |
| except (KeyboardInterrupt, SystemExit): |
| raise |
| except Exception: |
| print(sys.exc_info()[1]) |
|
|
| print('\nfinished: errors=%d' % (errors,)) |
|
|