[Soap-Python] soaplib 0.9/1.0: repeating elements without a bounding element
Robin Pedersen
robinp at snap.tv
Mon Sep 27 11:46:43 CEST 2010
First of all, I'm in the middle of porting a project based on the old 0.8
API to the 0.9/1.0 API, and the new way of doing it is far better. Before,
we had to write most of our custom SOAP types overriding to_xml and create
the XML code manually, but not anymore.
However, I have a problem with repeating elements without a bounding
element. There used to be a class called "Repeating", but it was removed
as part of the rewrite. What I want to have is basically something like
this:
# Python
class BillItem:
id = Integer
name = String
price = Double
class Bill:
charge = Double
guestName = String
billItems = Array(BillItem) # 0.8: Repeating(BillItem)
# Generated SOAP
<Bill>
<charge>20.0</charge>
<guestName>Mr. Soaplib</guestName>
<BillItem>
<id>1</id>
<name>Kawa</name>
<price>10.0</price>
</BillItem>
<BillItem>
<id>1</id>
<name>Kawa</name>
<price>10.0</price>
</BillItem>
</Bill>
But with "Array", I get this instead:
# Generated SOAP
<Bill>
<charge>20.0</charge>
<guestName>Mr. Soaplib</guestName>
<billItems>
<BillItem>
<id>1</id>
<name>Kawa</name>
<price>10.0</price>
</BillItem>
<BillItem>
<id>1</id>
<name>Kawa</name>
<price>10.0</price>
</BillItem>
</billItems>
</Bill>
--
Best regards,
Robin Pedersen
Software Engineer
SnapTV AS
More information about the Soap
mailing list