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!

Reply via email to