I have tried what you suggested, but I still either get that Item does not exist, or when I pass it to the webservice function I get an error that it is the incorrect type. Here is the wsdl description of the function:
Headers have been stripped off.
<tns:SurveilPath>
<label href="#id1" />
<path href="#id2" />
</tns:SurveilPath>
<types:SrLabel id="id1" xsi:type="types:SrLabel">
<value xsi:type="xsd:string">string</value>
</types:SrLabel>
<types:SrPath id="id2" xsi:type="types:SrPath">
<points href="#id5" />
</types:SrPath>
<soapenc:Array id="id5" soapenc:arrayType="types:Point2D[2]">
<Item href="#id6" />
<Item href="#id7" />
</soapenc:Array>
<types:Point2D id="id6" xsi:type="types:Point2D">
<latitude xsi:type="xsd:int">int</latitude>
<longitude xsi:type="xsd:int">int</longitude>
</types:Point2D>
<types:Point2D id="id7" xsi:type="types:Point2D">
<latitude xsi:type="xsd:int">int</latitude>
<longitude xsi:type="xsd:int">int</longitude>
</types:Point2D>
Using the wsdl definition I have tried the following to no avail:
1.)
path = client.factory.create('ns0:SrPath')
path.points = client.factory.create('ns0:ArrayOfPoint2D')
path.points.Point2D = []
# append points to path.point.Point2D
2.)
path = client.factory.create('path')
path.points = client.factory.create('ns0:ArrayOfPoint2D')
path.points.Item = []
# append points to path.point.Item
3.)
path = client.factory.create('ns0:SrPath')
path.points = []
# append points to path.points
4.)
path = client.factory.create('ns0:SrPath')
path.points.Points2D = []
# append points to path.points.Points2D
Nothing seems to be working.
What am I doing wrong? Am I not understanding the wsdl correctly?
Hey David,
The rpc/encoded (section 5 encoded) arrays are defined as sequence of uncounded <xs:any/>. So, after you create the array, you need to add an attribute to the sudsobject (with is the any) with the value of [].
Here's an example: http://svn.fedorahosted.org/svn/suds/trunk/tests/axis1.py
See below:
-jeffTry:
David Bunch wrote:
Hi I have a question about ArrayTypes.
I have a webservice function that takes an ArrayOfPoints, Which is an ArrayType that holds Point objects.
Now, I can create the individual Point objects, but how do I create an ArrayOfPoints and add points to it? I tried this:
ArrayOfPoints = myClient.factory.create('ArrayOfPoints')
but then, how do I add points to it? List operations don't seem to work. And when I do this:
ArrayOfPoints = [Point1, Point2, Point3]
myClient.service.calculateCenter(ArrayOfPoints)
>
> ArrayOfPoints.items = [Point1, Point2, Point3]
>
The "items" is arbitrarily named as it represents the <xs:any/> part of the array definition.
------------------------------------------------------------------------
I get a fault error saying that ArrayOfPoints could not be serialized.
Any help/insight on this would be much appreciated.
Sincerely,
-David
_______________________________________________
fedora-suds-list mailing list
fedora-suds-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-suds-list
_______________________________________________
fedora-suds-list mailing list
fedora-suds-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-suds-list