views:

34

answers:

1

Hi guys! I have an issue when consuming a web service from a Flex app. In the backend I have a hierarchy, let's say I have an abstract class Fruit, and 2 implementations: Apple and Orange. Fruit has a property, name, Apple has a property color, and Orange has a property radius. Then, I have a service wich returns a collection of Fruit. When I consume it from Flex, this collection returns objects wich type are Fruit, with its name property; but I lose all the properties for the implementation classes (color nor radius). So, the question is, does Flex support inheritance mapping when using web services? If not, is there any workarround? I hope to be clear enough. Let me know if not. Thank you. Jorge

A: 

Is this a SOAP service implementation? Are you using the FlashBuilder "import wsdl" feature, or something else?

You can use Flash builder to import the WSDL and dynamically generate the AS classes. You should have the derived classes imported there. When your data comes in, you'll need to cast the fruit objects into their correct child classes. Check to make sure your WSDL is properly constructed - I don't see why sending the collection in that way would pose a problem for Flex.

If you could give more detailed information on the web service architecture it might help us give a more detailed answer.

RJ Owen