WebReference.com - Part 3 of chapter 3 from Professional Java Web Services, Wrox Press Ltd. (1/3)
[next] |
Professional Java Web Services
Job Resumé Repository Service
[The following is a continuation of our series of excerpts from chapter 3 of the Wrox Press title, Professional Java Web Services. The code for the examples discussed in this excerpt can be downloaded from the Wrox Web site (free registration required).]
In the previous section we discussed how to deploy and run a "Hello World" service. In upcoming sections we will dive into the details of how to develop a SOAP service and SOAP client using the Apache SOAP toolkit. We are going to use a more complex example to do this. The example will be based on a fictional staffing company that desired to create a "Job Resumé Repository Service" that allows resumés to be submitted (for the purpose of storing) and retrieved. In this section we will discuss:
- The motivation for developing this application
- How different components of the application interact by discussing the sequence diagrams for submitting and retrieving a resumé
- Assumptions made when this service was developed
- Configuring the environment so that service can be run
The Motivation
The motivation behind the development of this service was that the company currently had numerous applications that had the ability of submitting resumés to and retrieving resumés from their database. Some applications were client-server and others were web-based. The majority of the web-based applications were accessible via their intranet and others were being accessed via the Internet. The goal of the staffing company was to remove the redundant functionality from all of its applications and only use the "Job Resumé Repository Service" to handle the submitting and retrieving of resumés. It also wanted the service to be utilized by other staffing companies across the Internet, which is easily achievable since SOAP can be transported using HTTP.
Sequence Diagrams
Instead of using a command-line SOAP client to access the service like the one we used in the "Hello World" service we developed a web-based SOAP client. A high-level sequence diagram for submitting a resumé and retrieving a resumé is shown below:

Submit Resumé Sequence Diagram
In the above sequence diagram an end user populates an HTML form with the contents of a
resumé. Once the resumé is submitted, it is sent to a servlet called SubmitServlet.
First, the SubmitServlet takes the form variables and creates a Resume object to
represent the contents that were entered on the form. Secondly, the Apache SOAP client API is used to
create and send a SOAP RPC request message that specifies that the submit method of the
Job Resumé Repository Service should be invoked with the Resume object as the
parameter. When this message is received by the Apache SOAP runtime the RPC request is forward to the
JobResumeRepositoryService class, which actually implements the method. After the request
is processed the response is sent back to the Apache SOAP runtime. The return value is then packaged
in a SOAP RPC response message and sent back to the SubmitServlet. The SubmitServlet
generates some HTML based on the return value and sends it back to the web browser.

Retrieve Resumé Sequence Diagram
In the above sequence diagram an end user populates an HTML form with the unique ID (uid)
of the resumé to retrieve. The request is sent to a servlet called RetrieveServlet.
The RetreiveServlet uses the Apache SOAP client API to create and send a SOAP RPC request
message that specifies that the retrieve method of the Job Resumé Repository Service
should be invoked with the uid as the parameter. When this message is received by the
Apache SOAP runtime the RPC request is forwarded to the JobResumeRepositoryService class,
which actually implements the retrieve() method. After the request is processed the
response is sent back to the Apache SOAP runtime. The return value is a Resume object if the
uid was valid, otherwise the value is null. The Resume object is
packaged in a SOAP RPC response message and sent back to the RetreiveServlet. If the return
value is not null then the RetrieveServlet generates an HTML page that
represents the resumé and sends it back to the web browser.
[next] |
Created: May 30, 2002
Revised: May 30, 2002
URL: http://webreference.com/programming/java/webservices/chap3/3/


