Might want to try making employeeID a Number instead of an int. If that doesn't work use this: http://www.darronschall.com/weblog/archives/000247.cfm
HTH, Ben --- In flexcoders@yahoogroups.com, "Robin Burrer" <[EMAIL PROTECTED]> wrote: > > 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.employeeName); > > > > > > > > } > > > > > > ]]> > > > > > > > > /// the web service object > > </mx:Script> > > > > <mx:WebService showBusyCursor="true" > wsdl="http://localhost/ComplexDataTypeService/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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of ben.clinkinbeard > Sent: Tuesday, 12 December 2006 2:02 PM > To: flexcoders@yahoogroups.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 flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > , "Robin Burrer" <rburrer@> 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::[EMAIL PROTECTED] to webserviceClasses.TelephoneNumber. > > > > > > > > > > > > Any help is highly appreciated. > > > > > > > > > > > > Robin > > >