aspose file tools*
The moose likes Web Services and the fly likes Suggestion Required on packaging POJOs/DTOs with Web Service projects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Suggestion Required on packaging POJOs/DTOs with Web Service projects" Watch "Suggestion Required on packaging POJOs/DTOs with Web Service projects" New topic
Author

Suggestion Required on packaging POJOs/DTOs with Web Service projects

Venkataprasath Padmanabhan
Greenhorn

Joined: Jul 14, 2011
Posts: 10
Hi,

Developing JAX-WS Webservices using Top down approach. the wsdl is defined with xsds, generating java code using IBM RAD tool creates package structure and all Request and Response java classes in Web Service Project. Most of these java objects represent the actual domain objects which will be used by DAO layer.

If we package DAO layer and business services in a separate project/jar, the Domain objects have to reside in this project.

Can anyone suggest the best option of handling this. Should we have all DAO layer within Web Service project so that DAO uses the classes generated using WSDL or move these classes to DAO project which requires a manual step whenever wsdl is changed?

Thanks,
Venkat
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
The classical answer is: It depends.
It depends on whether you expect changes to the web service or not, whether you expect changes to the system or not.
If you want to decouple the web service from the domain classes, then you should not let generated code leak down to the DAO layer. In fact, I would suggest having a look at the hexagonal architecture - develop the application without UI, database etc etc and, when the application itself is ready, add different kinds of adapters, in your case a database adapter and a web service adapter, as needed.
If you are in a hurry, do not expect changes in the web service or in the application etc etc, then you can generate code and use it in the DAO layer too.
Best wishes!

My free books and tutorials: http://www.slideshare.net/krizsan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Suggestion Required on packaging POJOs/DTOs with Web Service projects