--- In [email protected], "djepyon" <i...@...> wrote:
>
> Hey flexiverse, is there a way to generate dto's and have strongly typed 
> result objects from REST services in flex?
>

Short answer: POX  (Google it...)

Long answer:
1) Have each REST service serialize its result as XML (or possibly JSON)
2) Have each REST service return that chunk of XML
3) From Flex, call each REST service (method) using the <HTTPService> class and 
the send() method
4) In Flex, define a Value Object (VO) class which has properties that map to 
the properties of each type of XML that your service methods can return (the VO 
class defines your strongly-typed object)
5) In the HTTPService, set the result type to e4x (for XML, that is)
6) In the HTTPService's result handler, use E4X to extract the values from the 
XML chunk and then put those values into an instance of the corresponding VO 
class.

Optionally:
--Make the VO class [Bindable]
--Store multiple instances of (same-class) VOs in ArrayCollection instances
--Use XDocLet or other templating/transformation tools to automatically 
generate the Flex VO (client-side object) definitions from server-side 
classes/XML schema/etc.

Reply via email to