Meaningless Drivel is fun!*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Web Application and Web Service inside one 'War' archive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Web Application and Web Service inside one Watch "Web Application and Web Service inside one New topic
Author

Web Application and Web Service inside one 'War' archive

vishalraju shah
Greenhorn

Joined: Oct 06, 2007
Posts: 19
Hi All,

I'm kind of seek help in design (or may re-usable pattern) based on ranchers experience.

I have one Inventory web-service which has couple of operations exposed. I'm using Apache CXF (JAX-WS2.0) and design is simple as follow.

WebServiceImpl -> Spring Service (2.5.6) -> Hibernate DAO (3.x) -> DB (MySQL)

These web-services works fine & satisfies need for the business for end clients. However, I'm now in need of preparing a web-ui which pulls/updates the data using the web-app. (Not all CRUDS - But at least Read, update and search).

Design I'm preparing is-

WebApp (JSP) - Action - (Re-use) Spring Service (2.5.6) + Any new Services -> remaining layes as it is.

My intention is to re-use Spring Service layer and DAO layer I've written (May be with new interfaces for web-application). Is this a valid (good) design to tie back-end implementation of web-service & web-application togather ?

Thanks,
Vishal Shah


SCJP1.4 (92%), SCWCD (85%), SCBCD (81%), SCEA-I (In Progress)
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Is this a valid (good) design to tie back-end implementation of web-service & web-application togather?


No this is not a good design. It is better to keep web services and web applications separate. Both can certainly work together and have their own codebase.

vishalraju shah
Greenhorn

Joined: Oct 06, 2007
Posts: 19
Hi Jimmy,

Thank you for your response. Can you help me in understanding why keeping those two seperate shall be better ? I've seen Appfuse framework example where they have got Web-Application & Web-Service (User service) tied togather in one war. I also posted similar question on their forum but has received no response yet.

Thanks,
Vishal
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Thank you. Examples on Internet websites do not always show efficient designs, workable solutions, or accurate information. Loose coupling in terms of system components will help in many areas, e.g. maintainability, system agility to handle revisions, etc.

Your signature line states that you have multiple certifications in software design. So, I'm sure that you have learned the reasons why keeping these two components separate is better. You just need to think a bit harder
vishalraju shah
Greenhorn

Joined: Oct 06, 2007
Posts: 19
Thank you for your response again. Yeah, I'm thinking & validating my design. However, it's always good to understand feedback/review from people who have attempted such things. I'm now trying modular web-app approach with three modules

1) spring/dao - in a single jar
2) web-app (war format)
3) web-service (war format)

In above, last two refers 1st jar in pom.xml. I'll post if anything is un-obvious I come arcoess.

Thanks anyway for your response.

Cheers
Vishal
 
 
subject: Web Application and Web Service inside one 'War' archive
 
Similar Threads
Clean Code: A Handbook of Agile Software Craftsmanship - Interfaces
Relationship between Model (in MVC) and DAO
Implement Transactions best way, in my application
Technology choice
Understanding DI