0

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?!

Assaf
  • 788
  • 2
  • 9
  • 23

2 Answers2

1

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.).

Assaf
  • 788
  • 2
  • 9
  • 23
0

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.

Oded Peer
  • 2,377
  • 18
  • 25
  • It doesn't say that we have to implement, it only says that you can do it if you are not satisfied with the serialization... – Assaf Nov 14 '11 at 14:47
  • 1
    You will at least have to implement Serializable for the BlazeDS serializer to pick up your class for serialization. Implementing Externalizable will allow you to write custom read and write methods for custom serialization. – Dennis Jaamann Nov 14 '11 at 16:21
  • The documentation states that the default data conversion of _flash.utils.IExternalizable_ is to _java.io.Externalizable_, this means the Java counterpart of the AS class must implement Externalizable. – Oded Peer Nov 15 '11 at 07:39