[Soap-Python] Returning an extensible array of key, value pairs from a SOAP service
Tres Seaver
tseaver at palladion.com
Wed Dec 1 13:12:31 CET 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 12/01/2010 06:29 AM, Dieter Maurer wrote:
> Michael Wood wrote at 2010-12-1 09:16 +0200:
>> I'm pretty new to SOAP and soaplib.
>>
>> Is there a way to have a list of key, value pairs where the values
>> could be any primitive type, or possibly a structure and return that
>>from a SOAP service?
>
> A long time ago, I made something like this with
> ZSI (and Zope). While this has been a SOAP (based) service,
> it was not described by a WSDL but instead used dynamic typing
> (each value in the SOAP message used an "xsi:type" attribute to
> specify its type).
>
> I expect that you want a WSDL described service.
>
> In principle, WSDL (more precisely "XML-Schema" on which WSDL depends)
> supports so called "urtype"s, among others an "anyType" "urtype".
> This is however an advanced feature. Frameworks might have
> difficulties with it (I met e.g. difficulties with "PyXB", quickly
> fixed by its author).
>
> I do know the "soaplib" details -- and wether it can handle
> arbitrary types.
>
> >So something like a Dict, where I can add to the
>> entries in the Dict over time without the WSDL changing. I'm using
>> the 1.0 branch of soaplib.
>>
>> I'll need to consume this from a client written in C/C++.
>
> Then, this client, too, must be able to handle "xsi:type" attributes.
> Maybe, this is even a stronger restriction than on the Python side.
>
>> If this is not possible, I'll just stick with a class with predefined
>> fields and use the ClassSerializer, but it would be nice if I could
>> avoid the WSDL changing and therefore having to update the client if I
>> add new fields to the class/dict/whatever.
>
> Maybe, other techniques would be more adequate for you
> (e.g. XML-RPC, JSON-RPC, ...)? They are "by nature" dynamic,
> not restricted by a static description.
You can define a method in soaplib as returnning 'Array(Any)'. Whether
a given client can handle that or not is a separate issue.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkz2O68ACgkQ+gerLs4ltQ537gCfderHzuqJFVamg0aCyY233MGq
fRoAniT5+BQMx4S3FynArz+r6JhbtVij
=w7U1
-----END PGP SIGNATURE-----
More information about the Soap
mailing list