You add these optional serialization properties in the <channel-definition> in
your services-config.xml file that your client is using to communicate with the
server.
These settings are specific to the channel/endpoint they're defined for (i.e.
not global).
So something like:
...
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint
url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<serialization>
<ignore-property-errors>false</ignore-property-errors>
<log-property-errors>true</log-property-errors>
</serialization>
</properties>
</channel-definition>
...
Seth
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of netdeep
Sent: Tuesday, May 13, 2008 8:09 AM
To: [email protected]
Subject: [flexcoders] Re: Sending data to the Server
Hey my bad, I just found out I was not instantiating my AxisObject class
correctly on the
flex side. So I can pass the variables find now. However I would still like to
figure out how
to turn on the warning messages in the config files so that in the future I can
hopefully
catch mistakes like this much quicker. If you have time and could post maybe a
more
complete sample along with which files you need to update, I'd appreciate it.
Thanks for the help.
--- In [email protected], "netdeep" <[EMAIL PROTECTED]> wrote:
>
>
> I got several errors on the server when I tried to add those properties to
> the services and
> messaging config files. Where are they supposed to go exactly? My messaging
> channel
is
> a ServiceAdapter defined in the messaging-config.xml file as:
>
> <adapter-definition id="TerracottaGateway" class="factory.ReportManager"/>
> ....
> <destination id="factory">
> <adapter ref="TerracottaGateway"/>
> <channels>
> <channel ref="my-polling-amf"/>
> <channel ref="my-streaming-amf"/>
> </channels>
> </destination>
>
> I have defined setters and get methods for classes. I even used cut and paste
> to make
> sure the actionscript and java names are identical for all of the variables
> and methods.
> Yet I still don't get java to recognize the Axis class. It has about 12
> variables. Most of
the
> variables are Strings and ints, but one is an ArrayList (ArrayCollection in
> Actionscript).
> However this conversion seems to work fine in my Chart class. Curiously my
> chart class
> maps fine from java to actionscript, even though I have no setter methods in
> it, only get
> methods. I have only two variables there: a String, and an ArrayList.
>
>
>
>
> --- In [email protected], "Seth Hodgson" <shodgson@> wrote:
> >
> > 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" <shodgson@> 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).
> > >
> >
>