Hi all. I have to pass an array of objects to a web service. Objects
are instances of MyClass.
---------------------------
# Defined in file named MyClass.as
class MyClass {
name:String;
surname:String;
}
---------------------------
# Excerpt from the main MXML file: the web service parameter is
# bound to a model:
<mx:Model id="MyModel">
<Contents><MyClass/></Contents>
</mx:Model>
<mx:WebService id="MyWebService"...... >
<mx:operation name="MyWebMethod">
<mx:request>
<MyParameter>{MyModel.Contents.MyClass}</MyParameter>
</mx:request>
</mx:operation>
</mx:WebService>
---------------------------
# When I call the web service method, I populate the model with
# and array of MyClass instances:
var arr:Array new Array();
var v:MyClass= new MyClass();
v.name="Peter";
v.surname="Pan";
arr.push(v);
v=new MyClass();
v.name="Capitain";
v.surname="Hook";
arr.push(v);
MyModel.Contents.MyClass=arr;
MyWebService.MyWebMethod.send();
---------------------------
Using the debugger, I see that the model is initialized in the
proper way (i.e. it contains a Contents object whose contents are
two MyClass objects).
The SOAP request is different though. MyClass objects are
named "item":
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<MyWebMethod xmlns="http://www.example.com/webservices/">
<Contents>
<MyClass xmlns="" />
<item xmlns=""><surname>Pan</surname><name>Peter</name></item>
<item xmlns=""><surname>Hook</surname><name>Capitain</name></item>
</Contents>
</MyWebMethod>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
How can I make them to be serialized as <MyClass> instead of <item>?
Thanks
fabio
------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/