[Soap-Python] Multiple nodes with soaplib

Burak Arslan burak.arslan at arskom.com.tr
Thu Sep 9 08:33:48 CEST 2010


 On 09/08/10 12:22, Luigi Balduzzi wrote:
> Hi. I'm using soaplib (cloned from github)and I have the following
> problem.
> I need to instantiate a node in a XML soap message with this schema:
>
> <xs:complexType name="DNSInformation">
>     <xs:sequence>
>         <xs:element name="FromDHCP" type="xs:boolean"/>
>         <xs:element name="SearchDomain" type="xs:token" minOccurs="0"
> maxOccurs="unbounded"/>
>         <!-- ... -->
>     </xs:sequence>
> </xs:complexType>
>
> So I've written a class:
>
> class DNSInformation(ClassSerializer):
>     __namespace__ = 'http://www.onvif.org/ver10/schema'
>     _type_info = [
>         ("FromDHCP", Boolean.customize(min_occurs = 1, nillable =
> False)),
>         ("SearchDomain", Token.customize(max_occurs = "unbounded",
> nillable = False)),
>         # ...
>     ]
>
> and a method:
>
>     @rpc(_returns=DNSInformation, _out_variable_name="DNSInformation")
>     def GetDNS(self):
>         dnsInfo = DNSInformation()
>         dnsInfo.FromDHCP = False
>         dnsInfo.SearchDomain = "a.b.c"
>         # ...
>         return dnsInfo
>
> It works fine.

great to hear.

> But if I'd like more than one SearchDomain, e.g. to obtain a message
> like this:
>
> <s0:DNSInformation>
>     <s1:FromDHCP xsi:type="xs:boolean">false</s1:FromDHCP>
>     <s1:SearchDomain xsi:type="xs:token">a.b.c</s1:SearchDomain>
>     <s1:SearchDomain xsi:type="xs:token">d.e.f</s1:SearchDomain>
> </s0:DNSInformation>
>
> how should I do? Is it possible to do this?
>

i was already working on this :) try with the latest trunk and let me know.

http://github.com/arskom/soaplib/commit/5177d64c254457daea8751c2ed927a996d03ba88




http://github.com/baxeico/soaplib/commit/c736898d2bca06a60dee5a8710f02d9d3e1db091

by the way, is this a hack or you have evidence that this is the
expected behaviour?


burak




More information about the Soap mailing list