Assaf
Assaf

Reputation: 808

BlazeDs serialization of Java objects

I have a few Java classes that implements Serialization, and corresponding AS objects (self-generated by GAS) that implements IExternalizable.

There is no problem receiving objects from the server, but when I try to send objects to the server - it throws an exception:

[BlazeDS]Class 'xxx' must implement java.io.Externalizable to receive client 
 IExternalizable instances. flex.messaging.io.SerializationException: Class 'xxx' must  
implement java.io.Externalizable to receive client IExternalizable instances.

Really I must implement Externalizable to send objects to Java server?!

Upvotes: 0

Views: 3034

Answers (2)

Assaf
Assaf

Reputation: 808

Actually, I don't have to implement Externalizable and even not Serializable. Instead I just have to specify, on the flex side that it is a remote class with alias that points to the full java class path. I should also make sure that the properties names (or getters and setters) are equal to the java object properties names. Finally, I should make sure that the object/properties types are matched or converted well (numeric java objects to Number in Flex etc.).

Upvotes: 1

Oded Peer
Oded Peer

Reputation: 2437

You must implement Externalizable.

See http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Developing/WSc3ff6d0ea77859461172e0811f00f6eab8-7ffdUpdate.html

Using custom serialization between ActionScript and Java

If the standard mechanisms for serializing and deserializing data between ActionScript on the client and Java on the server do not meet your needs, you can write your own serialization scheme. You implement the ActionScript-based flash.utils.IExternalizable interface on the client and the corresponding Java-based java.io.Externalizable interface on the server.

Upvotes: 0

Related Questions