File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Mark Hansen - Converting servlet design to Webservices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Mark Hansen - Converting servlet design to Webservices" Watch "Mark Hansen - Converting servlet design to Webservices" New topic

Mark Hansen - Converting servlet design to Webservices

Jalal ud Din

Joined: Dec 20, 2006
Posts: 24
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?

Mark D. Hansen
Ranch Hand

Joined: May 29, 2007
Posts: 61
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 class for creating RESTful Web services.

Mark D. Hansen
Founder and President, AgileIT LLC
Author of "SOA Using Java Web Services" -
I agree. Here's the link:
subject: Mark Hansen - Converting servlet design to Webservices
jQuery in Action, 3rd edition