Insights on Software Development and Architecture

ErionPC's weblog on software development

Tag Archives: java beans

Glassfish and XML Serialization

Having worked with the .NET frameworks in Visual Studio, whenever I implemented an ASPNET web service I was used to return generalized collections of my business objects which were declared in nested layers and I never had any problems because the returned values would always be xml-serializations of my classes. However, having to work with GlassFish now I found that serialization isn’t that immediate. After days of looking for documentation on this issue, I discovered that Glassfish doesn’t serialize your objects unless they respect the java-beans structure (private fields, public getters and setters in CamelCase and a no-parameter constructor) and (obviously) they need to implement the interface. I also found that nested classes can’t be serialized (but maybe I’m wrong).

I’ve written a more recent post on this topic. Click here to view it.