Professional Documents
Culture Documents
The client is a hospital employee who processes patient information and submits
insurance claims on behalf of the patient. This employee enters the patient
information and makes a query to the hospital server. The server uses a Web
service to call the patient and insurance servers to obtain the information
requested. The arrows represent a request-response transaction.
The client machine accesses the hospital application through a Web browser. The
Web browser prompts the client to enter information required for a query. The
client submits the request and the client’s browser displays the response from the
hospital application.
In this scenario, the cost of a patient’s hospital visit is paid for by the patient’s
insurance company. The following steps explain how the necessary information
flows through the scenario.
1. To receive payment, the hospital must submit a claim to the insurance
company. To begin the data exchange, a hospital employee enters an account
number for the patient into a form displayed in a Web browser
(HospitalInput.jsp) on the client.
2. The hospital application retrieves information about the patient from a
Document Access Definition Extender (DADX) Web service, and invokes a
The hospital application is implemented with Java™ servlets, JSP, and HTML. The
main function of the hospital application is to provide a user interface to the client.
The patient Web service responds to requests for patient information from the
hospital server. In the sample application, the patient Web service implements a
DADX Web service to query DB2® for patient information. The patient Web service
then returns the results to the hospital application as a SOAP encoded XML
document.
The insurance Web service processes the insurance claim submitted by the hospital
application through a Java bean Web service. The insurance bean performs a DB2
SQL query and returns an XML stream. The XML stream is then transformed using
standard XSL technology into the XML document that is returned to the hospital
application.
The following sections provide more details about the technologies that underlie
the sample application, how the sample application implements those technologies,
and what tools you will use to develop the sample application.
If you do not wish to complete the scenario but would like to run the application,
follow the steps in the “Preparing for the sample application” section, then import
the scenario into your workbench by selecting File > New > Other > Example
Project > Enterprise Applications > Hospital. Run the scenario by following the
instructions provided when the scenario is installed.
Implementation Details
To exchange data between the hospital Web application, the patient Web service,
and the insurance Web service, the sample application performs four major tasks:
v Retrieves patient information
v Submits the insurance claim
v Processes the claim
v Displays the claim response
These tasks are divided between the hospital application, the patient Web service,
and the insurance Web service as described in the following sections.
2
Retrieving patient information
The hospital application consists of several components, shown in the following
diagram, that are used to retrieve patient information and display it to the hospital
employee on the client.
At run time, the hospital servlet responds to the request to retrieve patient
information. The hospital servlet communicates with the DADX run-time through
the patient proxy. The patient proxy sends information such as the name of the
DADX group, the name of the DADX file, and any parameters required by the
DADX file to the DADX run-time. In this scenario, the patient proxy sends the
group name patientGroup, the file name patient.dadx, and the patient account
number to the run-time environment. The DADX run-time locates the patient
group and DADX file and queries the database. The run-time returns the result to
the patient proxy as an XML document using the SOAP protocol. The hospital
application then displays the result in a Web browser on the client.
Chapter 1. Overview 3
The insurance claim servlet makes a claim request through the insurance proxy to
the InsuranceServiceBean bean. The proxy calls the bean with the input parameters
to make the claim. In this scenario, the patient’s Social Security Number (SSN) is
the input parameter. The SQL to XML run-time code reads the template .xst file,
substitutes the SSN parameter, and then performs the query. The query returns an
XML stream.
You will create the query template file using the SQL query builder, and the
response.xsl file using the XML mapping editor.
In order to filter unwanted data from the query response, and to generate a result
that conforms to the hospital’s required format for a return, an XSL transformation
style sheet (response.xsl) is applied. The resulting XML document is returned to
the insurance claim servlet.
The following section describes how these technologies are implemented in the
sample application.
4
WSDL is an XML-based open specification that describes the interfaces to and
instances of Web services on the network. It is extensible, so endpoints can be
described regardless of the message formats or network protocols that are used to
communicate. For more information on WSDL, refer to (www.w3.org/TR/wsdl)
Together, Web services and SOAP enable businesses to make their services
available to many potential clients using a standard connection protocol. This
makes it possible for related businesses, such as insurance companies and health
care providers, to integrate their business processes over the Internet, making
transactions easier and more efficient.
For more information about SOAP, refer to the (Apache SOAP) site.
For a tutorial that covers only Web services, refer to the Getting Started document
for WebSphere Studio. For more information on Web services, refer to the online
help.
The proxy sends the remote call to the Web service as a SOAP message. SOAP
messages are essentially XML documents with another layer of abstraction for the
protocol requirements. Encoding data in XML makes it a platform-neutral,
plain-text object that can be sent using HTTP. After the Web service processes the
call, it returns a SOAP response to the calling application with the result.
Chapter 1. Overview 5
About DADX
The DAD Extension (DADX) is an extension of the Document Access Definition
(DAD) file in the DB2 XML Extender and includes standard SQL functionality that
does not use the XML Extender. A DADX document enables the creation of Web
services that store and retrieve XML documents. A DADX document specifies
how to create a Web service using a set of operations that are defined by SQL
statements and, optionally, DAD files.
The DB2 XML Extender provides the support for the XML-based operations that
store or retrieve XML documents from a DB2 database. An XML document can be
either stored in an XML column, along with its tags, or decomposed into a
collection of rows in tables using traditional relational data types. Similarly, an
XML document can be retrieved from an XML column or can be generated from a
collection of rows in tables. A user-specified file provides control over the mapping
of XML document elements to DB2 database columns for storage and retrieval,
called the Document Access Definition (DAD) file. The XML Extender offers a set
of stored procedures to decompose an XML document into existing table structures
or to generate an XML document from existing relational data. All of these features
of the DB2 XML Extender can be invoked through Web services.
The following section describes the tools you will use to develop the sample
application.
Next step
Before you can build the sample application, you need to prepare your
development environment. The next section describes the preparations you need to
make.
6
Chapter 2. Preparing for the sample application
Before you can develop the sample application, you need to perform the following
steps:
v Install the prerequisite software on your workstation
v Create the hospital and insurance databases
System prerequisites
You need the following software installed on your workstation:
v DB2 Universal Database™ (UDB) for Windows® Version 7.2 or higher installed
locally. DB2 is included with most configurations of the WebSphere Studio
product family. If DB2 was not included in your WebSphere Studio package, you
can download it from www.ibm.com/software/data/db2. The scenario will not
work if fixpack 4 is installed on version 7.2.
v DB2 Universal Database (UDB) for Linux Version 7.2 or higher installed locally
to the default location.
v Netscape version 6.0 or higher or Mozilla version 0.7 or higher
JDBC 2.0 allows Java applications to access relational and non-relational database
management systems. The following section only applies to Windows.
To create these databases, you will use setup files that are supplied. The files create
the following databases and tables:
Database Tables
HOSPITAL HEALTHCARERECORD
INSURE CLIENTINFO POLICYINFO
In addition to viewing the messages displayed by the batch files, you can use the
DB2 Control Center to check that the databases created successfully.
8
5. Invoke the insurance shell script by typing the following command:
./insure.sh. You should see messages saying that the various DB2 commands
in the shell file completed successfully.
In this project, an SQL script file is used to create the required tables on the
iSeries™. The script file is located in
WS_Installdir/wstools/eclipse/plugins/com.ibm.etools.webservice_version/
samples/hospital/create_databases in the navigator view of the project. To create
the tables and run the example, the driver file that accesses the iSeries database
must be locally available on your workstation. The driver file name is jt400.jar and
is located in the IFS of the iSeries in /QIBM/ProdData/HTTP/Public/lib/jt400.jar. You
can either map a network drive to this location or copy the jt400.jar file to a hard
drive on your workstation.
You must also ensure that the jt400.jar file is referenced in the Class path of the
Server Configuration before you run the sample applications.
Next step
Once you complete the preparation tasks, you are ready to develop the patient
application.
The patient Web service responds to requests for patient information from the
hospital server. The patient Web service implements a DADX Web service to
query DB2 for patient information. The patient Web service then returns the
results to the hospital application as a SOAP encoded XML document.
The patient Web project contains the patient artifacts such as the DADX group and
the DADX file. To create the Web project, do the following:
1. Switch to the Web perspective (Window > Open Perspective > Other > Web).
2. From the workbench, click File > New > Dynamic Web Project.
3. Type PatientProj in the Project name entry field.
4. Click Finish to create the PatientProj project. The PatientProj and DefaultEAR
projects are created. The Enterprise Application project stores the Web project
as a WAR file embedded in an EAR file that can be exported to a server.
Important: You can either import this DADX file or you can create it using the
SQL builder and XML from SQL creation wizards.
v To import the DADX file, follow the directions in “Importing the DADX file”,
then skip “Creating the SQL query”, and “Creating the DADX file”.
v To create the DADX file, skip the “Importing the DADX file” section and
following the directions in “Creating the SQL query” and “Creating the DADX
file”.
12
4. In the Directory text field, specify the following location of the DADX file. Use
the Browse button if necessary:
WS_Installdir\wstools\eclipse\plugins\com.ibm.etools.webservice_version\
samples\hospital\PatientProj\JavaSource\groups\patientGroup
5. Click OK.
6. Click Select All and select Overwrite existing resources without warning.
7. Click Finish. The patient.dadx file is imported into the PatientProj.
Now that you have imported the DADX file, continue the scenario with Creating
the patient Web service.
In the User ID and Password fields, type your DB2 user id and password.
In the User ID and Password fields, type your iSeries user ID and password.
6. In the Database vendor type field, ensure that the correct database driver is
selected.
7. In the JDBC driver field, ensure that the correct JDBC driver is selected.
8. In the Class location field, ensure that the path to your to your JDBC driver
class (in db2java.zip) is correct.
In the Class location field, ensure that the path to your JDBC driver class
(jt400.jar) is correct.
9. Click Finish. A connection to the hospital database is defined.
Now that you’ve defined the database connection, you need to copy the connection
information to the PatientProj project, by doing the following:
14
Now you need to specify which record you need returned. The query will be used
to return the health record for a certain account number.
1. Click the Conditions tab to open the Conditions page, click the first row, then
click the empty cell under the Column heading.
2. Click the drop-down arrow in the cell and select
HEALTHCARERECORD.ACCTNO from the list.
3. Click the first row, then click the empty cell under the Operator heading.
4. Select “=” from the list
5. Click the first row, then click the empty cell under the Value heading.
6. Type :acct then press Enter.
7. Save the query (File > Save). The Specify Variable Values dialog box opens
8. Click the first row, then click the empty cell in the Value field and type 34.
Press Enter, then click Finish.
The result of the query appears in the DB Output pane. If the query was
successful, the Status column will indicate “Success”. The DB Output pane should
look similar to the following:
Now that you have created the SQL query, continue the scenario with Creating the
DADX file.
The DADX file opens in the XML editor. Examine the file then close the editor.
Now that you have generated the DADX file, continue the scenario with “Creating
the patient Web service”.
You need to create a server and add the DB2 driver (db2java.zip) from the java12
directory to the ws.ext.dirs server path before you run the Web service wizard. See
the “Application testing and publishing” help topic for instructions for creating a
server and adding drivers to your server path.
To create the patient Web service from the patient.dadx file, do the following:
1. Switch to the Web perspective (Window > Open Perspective > Other > Web)
if necessary.
2. In the Project Navigator view, expand the PatientProj project, Java Resources
folder, and groups.patientGroup folder and select the patient.dadx file.
3. Click File > New > Other > Web Services. Select Web Service and click
Next to start the Web service wizard.
16
4. In the Web Services page of the wizard, ensure that DADX Web service is
selected from the Web service type menu. Ensure the Start Web service in
Web project, Generate a proxy and Test the generated proxy check boxes
are selected. Click Next.
5. In the Service Deployment Configuration page, ensure that the proper server
enviroment is selected. Use the Edit button to change the server environment,
if necessary. Click Next.
6. In the Web Service DADX File Selection page, ensure that
/PatientProj/JavaSource/groups/patientGroup/patient.dadx, is specified. Click
Next.
7. The Web Service DADX Group properties page of the wizard is used to
update your group properties.
a. Ensure the DB URL field displays jdbc:db2:hospital.
It may take a few minutes for the Web service to be generated. The Web service is
deployed to the WebSphere Application Server and an internal Web browser is
launched to demonstrate the sample application.
The Web service will be deployed using the WebSphere Application Server unit
test environment. The Server perspective automatically opens and a Server project
is created in the Navigator view. The WebSphere Test Environment starts. Now
that you have created the insurance Web service, test the method of the patient
DADX Web service, findPatient.
If the pages appear broken, click the refresh icon on the Web Browser.
When you have finished examining the findPatient method of the sample Web
application, exit the Web browser.
Any changes you make to your Web service can be retested by returning to the
Web browser. When running a test environment, the server is running against the
resources that are in the workbench. The server will pick up any changes you
make to the Web project without being restarted. When you have finished testing,
close the Web browser.
Next step
Now that you’ve developed the code for the patient application, you can create
and deploy the insurance Web service.
18
Chapter 4. Developing the code for the insurance Web service
In this section, you will use the XML tools in WebSphere Studio to generate the
code required by the insurance Web service by doing the following steps:
v Create the project that will contain the source files for the insurance Web service.
v Use the SQL query builder to generate the SQL query that retrieves policy
holder information from the database in the insurance Web service and generate
the template file.
v Use the XML to XML mapping editor to generate the XSL transformation style
sheet that the insurance Web service uses to filter out unwanted data from the
health policy information retrieved from the insurance database.
v Create the insurance Web service.
The insurance Web service processes the insurance claim submitted by the hospital
application through a Java bean Web service. The insurance bean performs a DB2
SQL query and returns an XML stream. The XML stream is then transformed,
using standard XSL technology, into the XML document that is returned to the
hospital application.
A Web project contains all of the resources required for the insurance Web service,
such as the InsuranceServiceBean bean, the JSP files, the WSDL documents, and
the deployment descriptors. The Web service uses servlet technology which runs
only in a Web project. To create the Web project for the insurance company, do
the following:
1. Switch to the Web Perspective (Window > Open Perspective > Other > Web).
2. On the main menu bar, click File > New > Dynamic Web Project.
3. In the Project name entry field, type InsuranceProj. Click Finish.
4. Right-click the project to open the pop-up menu for the InsuranceProj and
select Properties.
5. In the Properties window, select Java Build Path under the Libraries tab.
6. Click Add Variable. Press and hold the Ctrl key and select XERCES_API_JAR,
and SOAPJAR. Click OK to close the dialog.
7. Click OK.
1. Click Finish. The JAR file is imported into the InsuranceProj project.
If you want to see the imported file, select the Project Navigator view and expand
the lib folder.
Important: You can either import the SQL query and XSL file into the insurance
Web project or you can create the SQL query and XSL file using the SQL query
builder and the XML to XML mapping editor:
v To import the source files, follow the directions in “Importing the source files”
below, then skip the directions in “Importing the DTD file and insurance bean”,
“Creating the SQL query”, and “Generating the XSL file”.
v Alternatively, to generate the source files, skip the “Importing the source files”
section and follow the directions in “Importing the DTD file and insurance
bean”, “Creating the SQL query,” and “Generating the XSL file”.
The code that you import or generate is required in order to query the insurance
database and return the health policy information.
20
Importing the source files
The source code for the insurance Web service is provided for you. To import the
source files:
1. Switch to the Web Perspective (Window > Open Perspective > Other > Web) if
necessary.
2. In the Project Navigator select the InsuranceProj folder.
3. Click File > Import to open the Import wizard.
4. Click File system to import the resources from the local file system. Click Next.
5. To enter the directory, click Browse to locate and select:
WS_Installdir\wstools\eclipse\plugins\com.ibm.etools.webservice_version\samples\
hospital\InsuranceProj
6. Click OK.
7. Click Select All to import the source files and folders.
8. In the Folder text field, ensure that the InsuranceProj folder is specified, then
click Finish to import the folders and files, and close the wizard.
Now that you have imported the SQL query and XSL file, continue the scenario
with Creating the insurance Web service.
Now that you have imported the bean, continue the scenario with “Creating the
SQL query”.
In the User ID and Password fields, type your DB2 user ID and password.
6. In the Database vendor type field, ensure that the correct database driver is
selected.
7. In the JDBC driver field, ensure that the correct JDBC driver is selected.
8. In the Class location field, ensure that the path to your to your JDBC driver
class (in db2java.zip) is correct.
In the Class location field, ensure that the path to your JDBC driver class
(jt400.jar) is correct.
9. Click Finish. A connection to the insurance database (INSURE) is defined.
Now that you have defined the database connection, you need to copy the
connection information to the workspace by doing the following steps:
1. In the DB Servers pane, expand Insurance_connection and right-click
insure(jdbc:db2:insure). From the pop-up menu select Import to Folder. The
Import to Folder dialog opens.
22
Defining the SQL statement
The SQL statement specifies the tables and fields that are queried in the insurance
database, and the conditions that govern the query. To define the SQL statement,
you first give the statement a name:
1. Make sure you are in the Data perspective (Window > Open Perspective >
Other > Data)
2. Click the Data Definition tab.
3. Expand the contents of the InsuranceProj project, Web Content folder,
WEB-INF folder, databases folder and the insure database until you find the
Statements folder.
4. Right-click the Statements folder and select New > Select Statement.
5. In the Statement Name text field, type FindHealthPolicy, then click OK. This
launches the SQL query builder.
Note: Ensure that you specify the correct case when typing FindHealthPolicy.
For example, if you type findHealthPolicy instead of FindHealthPolicy
with an upper case F, the application will fail.
You can resize the Tables pane by hovering over the bottom corner of the pane
with your mouse until the cursor turns into an arrow. Click and drag to resize.
Now you need to specify that the query combines information from both the
POLICYINFO and CLIENTINFO tables for a given account number by doing the
following:
Finally, specify that the SQL query should retrieve health policy information for the
given account number by doing the following:
1. In the Graph pane, select all of the fields in the POLICYINFO table by clicking
each check box next to each field.
2. Using the same method, select the following fields in the CLIENTINFO table:
v SSN
v ADDRLINE
v CITY
v STATE
v COUNTRY
3. In the Conditions page (click the Conditions tab to open this page), select the
first row, then click the empty field below the Column heading. The field
displays a down arrow on the right side.
4. Click the down arrow, and from the pop-up list click CLIENTINFO.SSN.
5. Click the empty field below the Operator heading, then click the down arrow.
6. From the pop-up list, select =.
7. Click the empty field below the Value heading, type :SSN and press Enter.
Make sure that you included the colon with this string. SSN is a variable that
will contain at run-time the social security number for the query.
8. Click the empty field below the AND/OR heading, then click the down arrow.
9. From the pop-up list, select AND.
10. Select the next empty row. Click the field below the Column heading, then
click the down arrow.
11. From the pop-up list, click POLICYINFO.POLICYTYPE.
12. Click the next empty field below the Operator heading, then click the down
arrow.
13. From the pop-up list, select =.
14. Click the next empty field below the Value heading, type ’health’ and press
Enter. Make sure that you included the single quotes in this string. This value
specifies that the query retrieves health policy information for the given social
security number.
24
Testing the query
Now that you have created the query, you should test it to ensure that it returns
the correct result. To test the query, do the following:
1. Select SQL > Execute.
2. Click Execute in the Execute SQL Statement dialog. The Specify Variable Values
dialog box opens.
3. In the Value field, replace NULL with the text ’123-45-6789’. Include the single
quotation marks. Press Enter, then click Finish.
If the query is successful, the result in the DB Output pane looks like this:
When you save the query, the Specify Variable Values dialog box will open. In the
Value field, replace NULL with the text ’123-45-6789’. Include the single quotation
marks. Press Enter, then click Finish to save the query.
Now that you have created the SQL query, continue with “Generating the XSL
file”.
The XML to XML mapping editor generates the style sheet based on the mapping
between a source and a target XML document. Mapping identifies what elements
in the source XML document will appear in the target XML document. The source
XSD for the health policy information is FindHealthPolicy.xsd, and the target DTD
that defines the claim response is Response.dtd. Response.dtd is already created for
you and you imported it in a previous step. You will create the
FindHealthPolicy.dtd. You will use the XML mapping editor to map the source and
target elements before generating the style sheet.
First, you need to open the source and target XML files by doing the following:
1. Switch to the XML perspective (Window > Open Perspective > Other >
XML).
2. In the Navigator view, expand the InsuranceProj, JavaSource, and query_info
folders.
3. In the query_info folder right-click FindHealthPolicy.xsd. Click Generate >
DTD.
4. Accept the default values and click Finish. FindHealthPolicy.dtd is generated
into the query_info folder.
5. Select the query_info folder. From the workbench, click File > New > XML >
XML to XML Mapping and click Next. The XML to XML Mapping dialog box
opens.
6. In the Folder text field, ensure the following is specified: InsuranceProj/
JavaSource/query_info.
The File name field specifies the mapping session name. Leave the default as
is, and click Next. The New XML to XML Mapping wizard opens.
7. Expand the InsuranceProj, JavaSource and query_info folders and select
FindHealthPolicy.dtd.
26
8. Click > to add the file to the Selected Files pane.
9. Click Next. The Specify Target XML, DTD, or XSD File dialog box opens.
10. Expand the InsuranceProj, JavaSource, and query_info folders and select
Response.dtd.
11. Click Next. The Root Element dialog box opens.
12. In the Target root element field, ensure that response is specified.
13. In the Source root elements field, ensure that SQLResult is specified.
14. Click Finish. This launches the XML to XML mapping editor. The source DTD
and target DTDs appear in the center pane of the workbench, and when
expanded look similar to the following diagram:
The next step is to map the source and target elements by doing the following:
1. Expand the element in the Source and Target panes.
2. Select POLICYNUM in both the Source and Target panes, then right-click on
the Target pane and select Create Mapping. The mapping specifies that the
POLICYNUM element in the health policy information will also appear in the
claim response. Notice that the Overview pane is updated to show the
mapping between the source and target elements.
You can also create a mapping by selecting POLICYNUM in the Source pane
and dragging the mouse pointer to POLICYNUM in the Target pane.
3. Follow the same procedure as in step 2 to map the following elements in the
source DTD file to the equivalent target DTD:
v SSN
v ACCTNO
v COVERAGEAMOUNT
v ADDRLINE
v CITY
v STATE
v COUNTRY
The elements in the source file that were not mapped to any elements in the
target DTD will not appear in the claim response that is returned to the
hospital application.
Save the mapping session by selecting File > Save, then close the file.
Now that you have generated the XSL transformation file, continue the scenario
with “Creating the insurance Web service”.
28
7. The Web Service Java Bean Identity page of the wizard specifies your Web
service URI, scope, and the names of the generated files. Click Next to accept
the default values.
8. The Web Service Java Bean Methods page of the wizard displays a summary
of methods in your bean. The InsuranceServiceBean bean has one method that
is selected by default. You can specify input encoding and output encoding
styles. Ensure that SOAP encoding for the Input encoding is selected and
Literal XML encoding for the Output encoding is selected.
9. Select the Show server (Java to XML) type mappings check box, then click
Next.
10. In the Web Service Java to XML Mappings page, review your Web service
type mappings. Click Next to accept the default values.
11. In the Web Service Binding Proxy Generation page, review the bindings that
you will use to generate a Web service proxy. The client proxy provides a
remote procedure call interface to your Web service. The folder of the Java
client proxy defaults to /InsuranceProjClient/JavaSource. The name of the
fully qualified Java class defaults to proxy.soap.InsuranceServiceBeanProxy.
Click the Show mappings check box, then click Next.
12. In the Web Service XML to Java Mappings page, review your Web service
client type mappings then click Next to accept the default values.
13. In the Web Service SOAP Binding Mapping Config page, click Next to accept
the default values.
14. In the Web service Test page, ensure that Test the Generated Proxy is checked
and Web service sample JSPs are selected. Click Finish to accept the
remaining default values and to open the Web browser. The sample Web
application demonstrates how to code a JSP in terms of the proxy file.
It may take a few minutes for the Web service to be generated. The Web service is
deployed to the WebSphere Application Server and an internal Web browser is
launched to demonstrate the sample application.
The Web service will be deployed using the WebSphere Application Server unit
test environment. The Server perspective automatically opens and a Server project
is created in the Navigator view. The WebSphere Test Environment starts. Now
that you have created the insurance Web service, test the method of the
InsuranceServiceBean.
When you have finished examining the processClaim method of the sample Web
application, exit the Web browser.
Any changes you make to your Web service can be retested by returning to the
Web browser. When running a test environment, the server is running against the
resources that are in the workbench. Any changes you make to the Web project are
picked up without being restarted. When you have finished testing close the Web
browser.
Next step
Now that you have developed the code for the insurance Web service, you can do
the same for the hospital Web service.
30
Chapter 5. Creating and deploying the hospital application
In this section, you will import the source files for the hospital application by
doing the following:
v Create the Web project that will contain the source files for the hospital
application
v Import the Java beans, JAR files, JSP files, and HTML files for the hospital
application.
The hospital application is implemented with Java servlets, JSP files, and HTML
files. The main function of the hospital application is to provide a user interface
to the client.
Before you can create the hospital application, you need to set up the project that
will contain the code for the application. All of the files for the hospital application
have been provided for you. The code is used to provide a user interface to the
client and includes beans, JAR files, JSP files, and HTML files for the hospital
application.
Once you have imported the XSD JAR files, you will import the client code.
The source code for the hospital client application is provided. You need to import
the source code into HospitalProj by doing the following:
1. In the Project Navigator view, select the HospitalProj folder.
2. From the workbench, click File > Import. The Import wizard opens.
3. In the wizard, select File system from the Select import source list, then click
Next.
4. In the Directory text field, specify the following location of the source code.
Use the Browse button if necessary.
WS_Installdir\wstools\eclipse\plugins\com.ibm.etools.webservice_version\samples\
hospital\HospitalProj
5. Click OK.
6. Click Select All and select Overwrite existing resources without warning.
7. In the Folder text field, ensure HospitalProj is specified. If the correct folder is
not specified, use the Browse button to specify the project.
8. Click Finish. The source code is imported into the HospitalProj project.
Note: In the Tasks view, you can safely ignore any errors or warnings that describe
broken links in the HospitalProj project.
32
Copy the proxies from the PatientProjClient and InsuranceProjClient
projects.
In a real world example, you would run the Web Services Client Wizard on the
WSDL for each of the Web services to generate the proxies. To simplify, you will
copy the proxies from the PatientProjClient and InsuranceProjClient projects to the
HospitalProj project.
Next step
Everything is now ready for you to test the hospital application sample application
using your Web browser.
3. In the Account number entry field of the Patient claim entry pane, type one of
the following account numbers: 34 or 35.
4. Click Submit. If you typed account number 34, the hospital application returns
the following Patient claim history page with the patient information:
36
The response includes information from different sources:
v The claim amount that was entered by the hospital employee and then
submitted to the insurance application for processing
v Patient information, including the address, policy number, and coverage
information that was retrieved from the insurance database by the insurance
application
All of this information is merged by the insurance application to produce the claim
response.
Summary
Now that you have successfully run the sample application, you have completed
developing the scenario. You have gone through the process of developing an XML
application, from initial preparation, through code development, to testing. You
used the XML and Web service tools to generate the code required by the sample
application, including generated Java classes, the XSL transformation style sheet,
and the SQL query. The final step in this process would be to deploy each Web
service on their respective Web application servers, such as WebSphere Application
Server.
Chapter 6. Running the hospital sample application and testing the Web service 37
38
Notices
Note to U.S. Government Users Restricted Rights - Use, duplication or disclosure
restricted by GSA ADP Schedule Contract with IBM Corp.
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in
other countries. Consult your local IBM representative for information on the
products and services currently available in your area. Any reference to an IBM
product, program, or service is not intended to state or imply that only that IBM
product, program, or service may be used. Any functionally equivalent product,
program, or service that does not infringe any IBM intellectual property right may
be used instead. However, it is the user’s responsibility to evaluate and verify the
operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter
described in this document. The furnishing of this document does not give you
any license to these patents. You can send license inquiries, in writing, to:
For license inquiries regarding double-byte (DBCS) information, contact the IBM
Intellectual Property Department in your country or send inquiries, in writing, to:
IBM may use or distribute any of the information you supply in any way it
believes appropriate without incurring any obligation to you.
The following paragraph does not apply to the United Kingdom or any other
country where such provisions are inconsistent with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
PUBLICATION “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OR CONDITIONS OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states
do not allow disclaimer of express or implied warranties in certain transactions,
therefore, this statement may not apply to you.
Lab Director
IBM Canada Ltd. Laboratory
8200 Warden Avenue
Markham, Ontario, Canada L6G 1C7
The licensed program described in this document and all licensed material
available for it are provided by IBM under terms of the IBM Customer Agreement,
IBM International Program License Agreement or any equivalent agreement
between us.
Any references in this information to non-IBM Web sites are provided for
convenience only and do not in any manner serve as an endorsement of those Web
sites. The materials at those Web sites are not part of the materials for this IBM
product and use of those Web sites is at your own risk.
This information contains examples of data and reports used in daily business
operations. To illustrate them as completely as possible, the examples may include
the names of individuals, companies, brands, and products. All of these names are
fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
COPYRIGHT LICENSE:
Each copy or any portion of these sample programs or any derivative work, must
include a copyright notice as follows:
(C) (your company name) (year). Portions of this code are derived from IBM Corp.
Sample Programs. (C) Copyright IBM Corp. 2000, 2003. All rights reserved.
40
Programming interface information
Programming interface information is intended to help you create application
software using this program.
However, this information may also contain diagnosis, modification, and tuning
information. Diagnosis, modification and tuning information is provided to help
you debug your application software.
Java and all Java-based trademarks and logos are trademarks or registered
trademarks of Sun Microsystems, Inc. in the United States and other countries.
ActiveX, Microsoft®, Windows, Windows NT®, and the Windows logo are
trademarks or registered trademarks of Microsoft Corporation in the United States,
or other countries, or both.
Other company, product, and service names, which may be denoted by a double
asterisk(**), may be trademarks or service marks of others.
Notices 41