On the one hand, I have a java class (actually a set of classes) that does a lot of low level input/output operations.
On the other hand I have a web console in jsp/servlets.
I want to be able to invoke a method on the "low-level" java app from the web console bearing in mind that the war will run on one computer on the network and the "low-level" app on another computer on the network.
What is the best way to invoke a public method of the "low-level" app from the web console???
you may use RMI, or you can wrap your application services as XML web services to be able to invoke them from the remote web application.
You can create a simple network server nad use the network server but i do not recommand this solution.
Best option, if it does not break your design is web services. IMHO
Joined: Apr 24, 2004
I thought of using web services however I don't know how to connect the low-level app to the app server (I do need an app server in order to have a web service?? Don't I?) Do you see what I mean? Julien.
No, you don't need an app server for WS; a web server with a SOAP engine will suffice (e.g. Tomcat with Axis). If having an extra web server is not possible for some reason, you might take a low-level approach and open a Telnet or SSH session to the target machine, and execute the low-level app in a command-line session. But a WS or RMI approach is certainly to be preferred.
Hello and thanks for the reply, I meant a "container" be it web or ejb (i use the term "app server" a bit freely). Can anyone tell me whether I can connect a servlet to a low-level app that does i/o operations?? Julien.
Joined: Mar 22, 2005
If by "connect a servlet to the application" you mean how the servlet can run the application and receive results from it, then one way is to use Runtime.exec. It provides the calling application with a Process object, through which input can be piped into the application and its output can be read.