Make sure your classes adhere to AMF serialization rules. You need public
get/set accessors for each property.
You can also use either of the following config settings for your
<channel-definition> on the server to further debug any problems with
de/serializing your custom types.
<channel-definition ...>
...
<properties>
<serialization>
<ignore-property-errors>false</ignore-property-errors>
<log-property-errors>true</log-property-errors>
</serialization>
You could use either (or both); when ignore-property-errors is false, an
exception is thrown when a property can't be handled rather than just being
ignored (the historic default to match player behavior).
When log-property-errors is true, you'll get a warning logged on the server
when a property is ignored. If you enable this, add Endpoint.* to your log
category filters to see these.
Seth
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of netdeep
Sent: Monday, May 12, 2008 12:07 PM
To: [email protected]
Subject: [flexcoders] Re: Sending data to the Server
Thanks for the reply Seth.
I am now able to send an ArrayCollection of my custom class Chart:
[Bindable]
[RemoteClass(alias="factory.data.Chart")]
public class ChartObject
{
private var name:String;
private var axisList:ArrayCollection;
public function getAxisList():ArrayCollection {
return axisList;
}
}
And I can read the array in the java message handler, and it even detects the
objects in
the array as Charts but when I try to get the axisList array from within Chart,
it comes up
as null. The axisList is an array of objects from another custom class I have
called Axis.
Here is a sample of the java Chart class for reference:
public class Chart {
//import mx.collections.ArrayCollection;
//import mx.controls.Image;
public String name;
public ArrayList axisList;
public ArrayList getAxisList() {
return axisList;
}
--- In [email protected], "Seth Hodgson" <[EMAIL PROTECTED]> wrote:
>
> You can send any type of data as the body of a message. If you want to send
> an instance
of a typed class, be sure to include [RemoteClass(alias="your.java.Class")]
metadata in
your ActionScript class so that the Player serializes it with type info and the
server can
deserialize it to your desired type.
>
> Seth
>
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of
netdeep
> Sent: Friday, May 09, 2008 7:21 AM
> To: [email protected]
> Subject: [flexcoders] Sending data to the Server
>
> I need to send data to the server. Up til now I've been using messaging. But
> as far as I
can
> tell, I can only send strings this way.
>
> What other alternatives are there? For instance, I would like to be able to
> send an array
or a
> custom data structure. I'm using Java for the backend. Ideally I would not
> want to launch
a
> new RemoteObject for each send from Flex, but instead have a persistent
> listener to
hear all
> requests (which is why I initially chose messaging and created a channel for
> the java
message
> manager to listen to).
>