Highlighted

Complex Java Object --> Flex using RemoteClass

Avatar

Avatar

raviiyer100

Avatar

raviiyer100

raviiyer100

02-09-2008

I have a complex Java Object on server side (with LCDS
running) - example below




Person is a java class with three attributes:

--> name: java.lang.String

--> age: int

--> residencyInfo: mypackage.ResidencyEnum



Person.class (implements Serializable)

|

|-- name (String)

|-- age (int)

|-- residencyInfo (ResidencyEnum)





mypackage.ResidencyEnum is a java 1.5 enum class containing
three ResidencyEnum public static variables named TX, MO, NY



I have an actionscript class for both these - Person.as and
ResidencyEnum.as



I have declared
[RemoteClass(alias="....")]

for both these, where each .as class refers to its equivalent
java class.



Now in the calling .as class, I'm requesting a REmoteObject
of type "Person".

I'm getting the Person object sent by java with "name" and
"age"

However the "residencyInfo" is coming through as null....



The error on the console is of two kinds:

Error# 1009 - Cannot access a property or method of a null
object reference.

Error #1034 - Type Coercion failed: cannot
convertObject@3kd84 to ResidencyInfo



Most examples on the web talk about how to serialize simple
java DTO/VO objects with only basic data types across LCDS to Flex.
I'm unable to find a solution to this problem.



Any help appreciated.



Thanks