Is this a .NET WebService?  I think we have a bug on this which is fixed in 2.0.  You can work around this by creating the request yourself <mx:request format=”xml”> and putting together the request yourself based on what the WSDL looks like.

 

Sorry!

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of fc989898
Sent: Monday, December 05, 2005 2:14 AM
To: [email protected]
Subject: [flexcoders] Web services: Question about array serialization

 

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








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to