All,
I've always thought that soap (section 5) encoded arrays support in suds could stand
much
improvement. The delay in doing this improvement has been due to priorities and a belief
that most of the web services providers were moving quickly towards document/literal
services and that rpc/encoded was going away. Anyway, after a few years now rpc/encoded
services are still very prevalent so time to make this better :)
So, 0.3.8 contains the following improvements:
* Arrays may be passed as parameters and nested object attributes using
simple python list|tuple. Although it is still supported, users no longer need
to use the Client.Factory.create() to create encoded array objects.
* soap-enc:arrayType attribute on soap messages now supported and added to array elements
in the soap message. Eg:
<dogs xsi:type="ns1:ArrayOfAnimals"
soap-enc:arrayType="ns0:Animal[2]">
<dog xsi:type="ns0:Dog">
<name xsi:type="xs:string">rover</name>
<age xsi:type="xs:int">3</age>
</dog>
<dog xsi:type="ns0:Dog">
<name xsi:type="xs:string">rover</name>
<age xsi:type="xs:int">3</age>
</dog>
</dogs>
* Arrays work for rpc/encoded services work the same way as they have in
document/literal services since the beginning of suds.
For ex:
version <= 0.3.7
client = Client(url)
array = client.factory.create('ns0:ArrayOfInt')
array.item = [10, 20]
client.foo(array)
version 0.3.8 (beta) r592+ supports the above plus:
client = Client(url)
client.foo([10, 20])
Or,
client = Client(url)
dogs = []
dog = client.factory.create('ns0:Dog')
dog.name = 'rover'
dog.age = 3
dogs.append(dog)
dog = client.factory.create('ns0:Dog')
dog.name = 'fido'
dog.age = 5
dogs.append(dog)
client.foo(dogs)
Or,
client = Client(url)
person = client.factory.create('ns0:Person')
dogs = []
dog = client.factory.create('ns0:Dog')
dog.name = 'rover'
dog.age = 3
dogs.append(dog)
dog = client.factory.create('ns0:Dog')
dog.name = 'fido'
dog.age = 7
dogs.append(dog)
person.dogs = dogs
client.foo(person)
I've tested against my (axis1,axis2 & jboss) servers. Also, tested against
public.py.
Hope you find this helpful.
Regards,
Jeff