1. Design for server side (JSP/Java servlet)
Based on the discussion on my previous blog, remove the embedded Jetty and make everything run in Tomcat.
On server side:
(1) JSP/servlet gets the parameters in the request from client;
(2) Start SimpleAxisServer(SAS) to call a CIMA web service;
(3) Receive the data at a listener of SAS;
(4) Write the data to a file;
(5) Send the URL of file back to client
On client side:
(1) Send the request to server;
(2) Receive the URL of the file;
(3) Parse the file content and display them on the browser
2. Implementation
(1) Server side
(a) Using Java servlet
Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
in class
public class
(b) Using JSP
In a JSP page,
- Get the parameters from request;
- Call a Java method to invoke the CIMA web service and another method to write data to a file;
- Return the URL of the file to client
(2) Client side
In
Discussion
(1) Comparison between Java servlets and JSP in this project.
Both Java servlets and JSP have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such high-level utilities. But as for outputting the result to the client, we need to write a zillion println statements to generate HTML. Plus, by separating the presentation from the content, we can separate the tasks on Web page design and servlet programming. In this project, it involves some static HTML content, and the client only needs the URL of the file, so use of a combination of JSP and servlets would simplifies the creation and maintenance of the HTML.
(2) Currently, we invoke CIMA web service by start a SimpleAxisServer, but in SimpleAxisServer API, there is a note -- This is a simple implementation of an HTTP server for processing SOAP requests via Apache's xml-axis. This is not intended for production use. Its intended uses are for demos, debugging, and performance profiling. Note this classes uses static objects to provide a thread pool, so you should not use multiple instances of this class in the same JVM/classloader unless you want bad things to happen at shutdown.
So it is necessary to remove SimpleAxisServer and just use Axis as an engine to invoke the web service
http://ws.apache.org/axis/java/apiDocs/org/apache/axis/transport/http/SimpleAxisServer.html
Reference
- JSP : the complete reference. Hanna, Phil.
- Core servlets and JavaServer pages. Hall, Marty; Brown, Larry
No comments:
Post a Comment