[Fedora-suds-list] May Suds be introducing an extra level of indirection?
Daniel Rodriguez
danjrod at gmail.com
Fri Apr 16 06:47:12 UTC 2010
Hi Jeff,
I am by no means a WSDL/XSD expert, but I think that Suds might be
introducing an extra level of indirection, although this can also be my
misinterpretation.
Definition of a complex type in the WSDL file:
<xsd:complexType abstract="true" name="APIResponse">
<xsd:sequence>
<xsd:element name="header" nillable="true"
type="types:APIResponseHeader"/>
</xsd:sequence>
<xsd:complexType name="GetCurrentBitsResp">
<xsd:complexContent>
<xsd:extension base="types:APIResponse">
<xsd:sequence>
<xsd:element name="bits" nillable="true"
type="types:ArrayOfBit"/>
<xsd:element name="errorCode" type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ArrayOfBit">
<xsd:sequence>
<xsd:element form="qualified" maxOccurs="unbounded" minOccurs="0"
name="Bit" nillable="true" type="types:Bit"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Bit">
<xsd:sequence>
<xsd:element name="size" nillable="false" type="xsd:double"/>
<xsd:element name="remaining" nillable="false" type="xsd:double"/>
</xsd:sequence>
</xsd:complexType>
The returned XML looks like:
<n:Result xsi:type="n2:GetCurrentBitsResp">
<header xsi:type="n2:APIResponseHeader">
...
</header>
<bits xsi:type="n2:ArrayOfBit">
<n2:Bit xsi:type="n2:Bit">
<size xsi:type="xsd:double">1.02</size>
<remaining xsi:type="xsd:double">0.0</remaining>
</n2:Bit>
<n2:Bit xsi:type="n2:Bit">
<size xsi:type="xsd:double">5.03</size>
<remaining xsi:type="xsd:double">3.51</remaining>
</n2:Bit>
</bits>
<errorCode xsi:type="xsd:string">OK</errorCode>
</n:Result>
In the generated Python objects the ArrayofBit is accessible with:
- result.bits.Bit
When I would expect (seeing the XML) to access the array with:
- result.bits
Maybe you or any other with a better knowledge of WSDL and XSD could clarify
if this should be the case or not.
Best regards
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/suds/attachments/20100416/25599b66/attachment-0001.html
More information about the suds
mailing list