Java Servlet and Web Services Communication
I have developed a java web application and the purpose of the application is to fetch the data which are updated or new from another site using their remote services. I have created a servlet and created some methods. These methods are accessible by passing the methodname as query parameter while calling the servlet. I have also created a web service for the methods which are available in servlet (in a separate class).
I have deployed the web service on Tomcat 5.5.9/Axis and web application on Tomcat ( same instance of Tomcat). Since one is web service and other is web application, I am duplicating the business logic/components and both are running separately also. I would like to use my business logic/components on either in web service or web application and divert the call from one to other.
(1) if I use the business logic/components on web service, then from my servlet, I would like to call the web service and return the result
(2) if I use the business logic/components on web application, then from my web service, I would like to call the servlet and return the result
Pl. advice me which one from the above method is good and how to implement that.