This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Mark, Currently I am developing a client server application. Java client (A command prompt based application) reads some data from com ports and converts this data to xml. It keeps adding data in xml for 1 hour and after every one hour it streams xml or http to a servelet. Servlet analysis the data and updates the database accordingly. Another servlet (server side) can communicate to dos based application by sending him xml at any point of time depending upon the user clicks on web. this xml is sent to dos based application and dos based application converts it to com commands and sends it to some hardware.
Do you think above problem can be better solved using web services? how?
Unless you want to publish the servlet functionality so that other clients can use it, there is no reason to convert to a Web service. If it is only a single client using it - and you are designing both the client and the servlet - then it is fine.
The benefit of Web Services is that you could publish your server side application so that a variety of clients could access it using XML/HTTP or SOAP.
If you want to convert the application to Web Services technology, just as a learning exercise, then you can do that. Chapter 3 of my book shows how to do the kind of thing you are describing both with servlets and with the javax.xml.ws.Provider class for creating RESTful Web services.