Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custamize serialization and deserialization when using IIOP

Raghu Medipalli
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to initilize some static fields on the client side with values present in an object returned from the server side.
The exact scenario is that on client side I call an EJB (present on server side). The EJB returns an object of
a specific class type to the client. This object is, I guess, serialized when sent over wire. I am implementing
the readObject() and writeObject() methods in the class whose object is serialized and sent over wire to
do my custom serialization as follows. The protocol we are using is IIOP.

I implemented the following methods on my client side.

private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
System.out.println("Inside readObject()");

MyValuableClass.myStaticAttribute = "newVersion";

private void writeObject( stream)
throws IOException, ClassNotFoundException {
System.out.println("Inside writeObject()");

The problem here is that the readObject() and writeObject() methods are not been called during
serialization and deserialization process. The System.outs are not printed at all. I came accross somewhere on the net that
if you are using IIOP then it has its own way of serializing and deserializing objects. Kindly let me know how I handle custome serialization
and deserialization if I am using IIOP. The goal I am trying to accomplish here is that whenever the object returned by EJB call is reconstructed (deserialized)
on the client side, I want to do the default serialization plus some static variables' initialization of one of my class with the values pesent
in the object returned by EJB. Any help is highly appreciated.

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic