[Soap-Python] Fwd: Array and max_occurs

Luca Dariz luca.dariz at unife.it
Mon Aug 16 15:28:19 CEST 2010


---------- Forwarded message ----------
From: Burak Arslan <burak.arslan at arskom.com.tr>
Date: 2010/8/16
Subject: Re: [Soap-Python] Array and max_occurs
To: Luca Dariz <luca.dariz at unife.it>


 ----- Original message -----
> Hi,
>
> i am a bit confised about array serialization in soaplib.
>
> One usually defines an array with
>
> @rpc(Array(String))
> def echo(self, s)
>
> that requires an envelope like
>
> <SOAP-ENV:Envelope xmlns:ns0="root_dev"
> xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
> <SOAP-ENV:Header/>
> <ns1:Body>
> <ns0:echo>
> <ns0:s>
> <ns0:string>s</ns0:string>
> <ns0:string>a</ns0:string>
> <ns0:string>r</ns0:string>
> </ns0:s>
> </ns0:echo>
> </ns1:Body>
> </SOAP-ENV:Envelope>
>
>
> but one could also write
>
> @rpc(String(min_occurs=1, max_occurs=10))
> def echo(self, s)
>
> that would need
>
> <SOAP-ENV:Envelope xmlns:ns0="root_dev"
> xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
> <SOAP-ENV:Header/>
> <ns1:Body>
> <ns0:echo>
> <ns0:s>s</ns0:s>
> <ns0:s>a</ns0:s>
> <ns0:s>r</ns0:s>
> </ns0:echo>
> </ns1:Body>
> </SOAP-ENV:Envelope>
>
>
> but the latter will not work since only the last value found in the
> envelope is passed to the method; I attach a little patch that tries to
> fix it.
>
> However in the two cases the envelope is different, and i think the
> envelope resulting from the second approach is simpler and maybe more
> compatible with different clients.
>
> What do you think is the best way to serialize arrays?
>
> Luca

hi luca,

from a theoretical perspective, i think the two methods work perfectly and
there's no real difference between them. and as it's possible to use both, i
think we should keep both methods as a possibility.

but, wsdl spec has an array type already defined and any array-ish type
SHOULD (or MUST, don't remember the exact word) inherit from that. maybe
that can be implemented to improve array support in soaplib.

best regards
burak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/soap/attachments/20100816/c44848d0/attachment.html>


More information about the Soap mailing list