true this issue comes even with remote objects call , I exactly not get the solution , but put some check at the time of return ,if its object create an array or do the this on flex .
Sajid ________________________________ From: claudiu ursica <the_bran...@yahoo.com> To: flexcoders@yahoogroups.com Sent: Thu, July 22, 2010 1:07:35 AM Subject: Re: [flexcoders] Web Services and ObjectProxy question for the Flex Gurus Are you generating the VO's on the client side? C ________________________________ From: flexcodemonkey <michael_regert@ dell.com> To: flexcod...@yahoogro ups.com Sent: Thu, July 22, 2010 2:39:24 AM Subject: [flexcoders] Web Services and ObjectProxy question for the Flex Gurus It seems like a common problem, I'm seeing tons of posts on the web, but no solid solution. I'm making a web service call which will return a complex data type, say Car. The Car has internal complex data types like Wheel, Door, etc. I'm using Flex 4 and I set the returntype for the webservice to return an array of Cars - Cars[]. If the web service returns more than 1, it successfully deserialized the data and returns an array of Car objects. BUT, if only one is returned, it returns an ObjectProxy, obviously because it cannot convert it to an array. Most solutions on the web show how to add this one item to an array. What I want is the actual object to be of type Car. If I change the returntype for the web service to return a single Car object, then when it returns one, it works, but more than one, it returns an array of ObjectProxy objects. I could check if the returned object is a single object, then spin through each attribute and convert it to a car, but because the car has other objects within it, they too show up as ObjectProxy objects, so I'd hve to spin through the tires, the doors, etc. which in my case is a lot of attributes, just to deserialize the object. Is there a solution for a web service to either a) always return an array, even if it is an array of 1, or b) a way for the Flex code to correctly deserialize both an array of Cars and 1 Car? Thanks!