Try ObjectUtil.toString(myObject)
Patrick
Robin Burrer a écrit :
>
> Thanks Ben,
>
> I tried that. It still does not work ..:-(. I got rid of everything
> which could cause errors. …
>
> Here’s the code. I reckon this is as basic as it gets …
>
> public function onMyResult(event: ResultEvent) :void
>
> {
>
> // this works fine
>
> var myObject:Object = Object(event. result);
>
> // this causes an error ( Error #1034: Type Coercion failed: cannot
> convert [EMAIL PROTECTED] to webserviceClasses. Employee. )
>
> var myEmployee:Employee = Employee(event. result);
>
> // does not work
>
> trace (myEmployee. employeeName) ;
>
> // does work
>
> trace (myObject.employeeN ame);
>
> }
>
> ]]>
>
> /// the web service object
>
> </mx:Script>
>
> <mx:WebService showBusyCursor="true" wsdl="http://localhost/
> ComplexDataTypeS ervice/Service1. asmx?WSDL" id="myWebservice"
> makeObjectsBindable ="false">
>
> <mx:operation name="getDetails" result="{ onMyResult (event)}"
> resultFormat="object"/>
>
> </mx:WebService>
>
> // the Employee object:
>
> public class Employee (AS)
>
> {
>
> public var employeeName: String;
>
> public var employeeID:int;
>
> }
>
> (c#)
>
> public class Employee
>
> {
>
> public string employeeName;
>
> public int employeeID;
>
> }
>
> Any ideas?
>
> Robin
>
> * From: * [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups.
> com] *On Behalf Of *ben.clinkinbeard
> *Sent:* Tuesday, 12 December 2006 2:02 PM
> *To:* [EMAIL PROTECTED] ups.com
> *Subject:* [flexcoders] Re: Flex and .net webservices
>
> Hi Robin,
>
> I have good news :), both of these issues should go away by setting a
> single attribute on your WebService object. Try setting
> makeObjectsBindable = false. This will cause Flex to deserialize your
> ws responses into regular Object and Array instances instead of
> ObjectProxy and ArrayCollection instances.
>
> HTH,
> Ben
>
> --- In [EMAIL PROTECTED] ups.com
> <mailto:flexcoders%40yahoogroups.com>, "Robin Burrer" <[EMAIL PROTECTED] >
> wrote:
> >
> > Hi there,
> >
> >
> >
> > I have been playing around .net and flex for a while. Primarily I want
> > to send value objects (consisting of strings, intergers and arrays of
> > VOs) back and forth.
> >
> >
> >
> > I could not figure out how to do the following things though:
> >
> >
> >
> >
> >
> > 1. Sending arrays to a webservice works fine. However when I
> > receive an array of the .net data type "array" flex creates and Array
> > Collection data type. Sending arrays as "array collections" to a web
> > service causes an error. That's really annoying when you try to keep
> > the VOs consitent on both ends. What's the solution for this?
> >
> >
> >
> >
> >
> > 2. When I receive a complex data type from a .net web service flex
> > creates an Object but when I try to cast this object to the dataType it
> > represents I get a complier error, even though the received object has
> > exactly the same properties as underlying VO.
> >
> >
> >
> > E.g. I get the following error code if I try to cast the result of a
> > webservice call to my custom data Type "TelephoneNumber" . Note casting
> > to an "Object" works fine.
> >
> >
> >
> >
> >
> > TypeError: Error #1034: Type Coercion failed: cannot convert
> > mx.utils::ObjectPro [EMAIL PROTECTED] to webserviceClasses. TelephoneNumber.
> >
> >
> >
> >
> >
> > Any help is highly appreciated.
> >
> >
> >
> >
> >
> > Robin
> >
>
>
--
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> 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/