开发者

Problem when mapping inheritance in web service for a Flex client

I have an issue when开发者_如何学Python 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 which returns a collection of Fruit. When I consume it from Flex, this collection returns objects which 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 workaround?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜