File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes java xml bindings & transfer objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "java xml bindings & transfer objects" Watch "java xml bindings & transfer objects" New topic
Author

java xml bindings & transfer objects

Udayan Kumar
Ranch Hand

Joined: Jan 16, 2007
Posts: 66
Hi All,

We have a requirement where in we need to communicate with a web service WSDL.Currently we are generating set of java classes (using xml beans) out of this wsdl.

Our application will be using these java classes to set the data before calling the web service and also will get data wrapped in these classes.

We did a proof of concept for the same and everything looks manageable for a small example but we have around 35 different types of web service calls to make (to & fro) each with a huge xml payload.

We do not have much idea on xml beans or java to xml binding and would like to know what are some of the guidelines to adopt

One observations these xml beans generated classes do not have
an inbuilt relationship (inheritance tree) which limits reusability.

I would like to know would it be a good idea to use these xml beans generated classes as transfer objects or can I create custom classes (transfer objects) extending these generated
classes & introduce some business logic in these custom classes.


Also currently in our code we have to do a lot of checks like null pointer checks for each & every field before fetching and setting values because of inherent nature of the underlying xml elements & attributes.
WHat i fear is when we go about creating code for moving data between application transfer objects & xmlbean generated classes there would lot of null pointer checks making the code unnecessarily ugly.
But using a separate transfer objects layer also keeps the client code separate and would not be affected if there are any changes to the underlying WSDL and we can carry out the modifications at a centralised location (i.e. some sort of mapper layer).

Do post your suggestions on the pros & crons of each approach.


-Uday
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java xml bindings & transfer objects