Sheptunov, Bogdan wrote:

Thank you Tony. This is what I ended up doing yesterday - putting underscores in front of the methods. Don't like it though, as technically by doing this I am in violation of coding standards, and in general this isn't a clean solution.
I actually thought I found a way to "tell" Axis that only properties of my choice should be returned, and it did not work. Here's an example. In my class that ends up being serialized, I set up this:

I believe Axis will need another serializer that takes advantage of java serialization mechanism. Using an hipotetic serializer/deserializer that supports java.io.ObjectOutput/java.io.ObjectInput and serialization/deserialization semantincs as described by:


http://java.sun.com/j2se/1.4.2/docs/guide/serialization/spec/serialTOC.html

you could just use the modifier "transient"; look at:

http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#78119

I think a "filter all those properties" way to hide bean properties for one object client (Axis) but not for others (server side object client) is not that easy to use like plain old serialization. Indeed, you would finally like to do the same in a web service than in any java application that needs serialization (like RMI): just to take this object out of this process/computer! And java serialization semantics cover the use cases you will find in a serialization/deserialization scenario.

A "filter all those properties" approach is to create a interface for each of those beans you would like to serialize, but just including getters and setters for those properties you really want to be serialized; then let your bean implement that interface (already does!) and alter all your web services to not use the bean class but the "filtered inteface". The main drawback (and innaceptable for me) is that all references to the bean class have to be replaced by the filtered interface, so one of your object clients (Axis) just see the filtered interface... but the other clients of your object (server-side client) will need to see the original bean class. I would not like to fill my code with casts or "instanceof's.

 A starting point to implement that serializer/deserializer could be this:

     http://java.sun.com/products/jfc/tsc/articles/persistence/

(Note I have referenced the first article revision, not the updates).



Reply via email to