I've done some applet, servlet and JSP work. Now I want to write a program (or service if you will) that sits on top of a database. This program will receive request with parameter to look up the database (as it executes a SQL stmt) and then return the query result back to the requester. This does not need a presentation layer, so no need for servlet or JSP(it would add overheads for the app server and alike). I started look into RMI, JINI and even EJB. But they seems to have their overheads as well. All I need is a program that runs like service (never ends) and able to execute from remote calling froma client or some sort. I know this is very vague, but I'm in the very early design stage!
its most likely will be over the internet. I'm reading on web services, it sounds like web services is a combination of JMS, EJB, Servlet, and all the other XML APIs. I got the Java Web Services Tutorial and exmaples, from it I've noticed that all the client calls are through JSP / servlet. Is it possible to have clients calling a client class locally and it would look up the registry to get to the server for request ? any other useful tutorials out there on the web? thanks
John, The reason most of the examples use jsp/servlets is because Web services are generally consumed(invoked) via the http or https protocols. This makes using web servies internet friendly. Nonetheless, and properly programmed java applications using sockets can also consume(invoke) web services. As for your solution, you can do a number of things: 1. Code the program that performs the database query as a server listening on a certain port for specific requests. When it receives the query, it responds with the result. 2. Use RMI 3. Use webservices. Probably your best bet because the protocols are clearly established and most client tools will be able to consume your web service. -- Rodney [ September 19, 2002: Message edited by: Rodney Woodruff ]
The problem with RMI and sockets is that you have to have a separate port which isn't firewall friendly. You also have to worry about scalability issues. And you need some process to make sure that RMI doesn't go down for whatever reason. Using your servlet engine is easy because it's already there, it's firewall friendly, it's scalable, easy to secure, network admins already have processes in place to start it when it goes down, etc. So web services using http or https gets rid of all the headaches. That's why it so popular right now.