<complexType name="A">
<sequence>
<element name="attrs" type="string" nillable="true"
minOccurs="0" maxOccurs="unbounded"/>
<element name="rels" type="tns:A" nillable="true"
minOccurs="0" maxOccurs="unbounded"/>
<element name="relName" type="string" />
</sequence>
</complexType>
Above is the xsd snippet of my webService operation.
Operation has one of the parameters of type A (above). On the flex
side, I have an action script class B that has get/set functions
for attrs, rels and relName. When I use an instance of this type as
a parameter to the webService operation in flex, it sends only
attrs and relName in the SOAPBody.
I also tried adding following function in class B and using
generic object one gets from extractObject function.
B
{
public function extractObject()
{
Object obj = new Object();
obj.attrs = attrs;
obj.relName = relName;
var relsArray:Array = relsArray = new Array();
for each(rel in rels)
{
relsArray.push(rel.extractObject());
}
obj.rels = relsArray;
}
}
Just one other weird behavior is following: Instead of
programatically getting the generic object
if I hardcode the steps to generate the Object instance,
webservice call works fine.
Something like
var o:Object = new Object();
o.attrs = attrs;
o.relName = "xyz";
var relsArray:Array = new Array();
var rel:Object = new Object();
rel.attrs = relAttrs;
rel.relName = "A";
relsArray.push(rel);
o.rels = relsArray;
Strangely enough, this works perfectly fine. The same when we
do it using the method function extractObject, doesnt work.
Can anyone please suggest a good way of handling nested data
structures in a webservice call?