Featured Database Articles
Posted Nov 17, 2008
Transforming Business Logic into Web Services Using DB2 9.5 and IBM Data Studio - Page 3
By Paul Zikopoulos
In this article, I assume you have
a copy of Application Server/CE, which is included as part of the IBM Data Studio media, and that you know how to
install it on your server for simple testing purposes. I recommend using this included
copy since it is the correct version: there are compatibility requirements
between some versions of Application Server/CE and IBM Data Studio for IBM DWS.
In order to access the included
copy, you can either perform a Custom installation of IBM Data Studio and select Application Server/CE from
the list of installable components, or rerun the IBM Data Studio installation and just add this component. Both
these actions place an installation image of Application Server/CE on your
server; after the IBM Data Studio installation, you
just double-click the installation image to install the product. For more
information about installing Application Server/CE, click here.
You can use the Installed
Runtimes button (shown in the previous window) to manage, add, or search
your server for other supported application servers. You can use the Add function
in the Installed Runtimes window to download a copy of Application Server/CE if
you didnt include it in the installation of IBM Data Studio, as shown below:
c. Accept the default settings for
the application server, and click Finish.
Once the application server has
been added, the Servers tab should look similar to this:
Note that you can deploy existing
Web services to the newly defined application server during the definition of
the application server; to do this, you would click Next and add the
appropriate project to the Configured projects box using the Add button;
however, that task is outside the scope of this article.
5. To start the application server
where you want to deploy the SOA_FEMALEPERSONNEL Web service, right-click the
server, and select Start.
It might take a few minutes for Application
Server/CE to start. The Servers tab will give you visual clues as to the
state of the selected application server:
You can also look at the bottom-right
corner of the IBM Data Studio IDE for progress
Although I wont delve into the
details of application server management within IBM Data Studio, you should know that the Console tab
gives you granular information about the target application server:
6. Build the Web service by
right-clicking the SOA_FEMALEPERSONNEL Web service and selecting Build
7. The Deploy Web Service window opens.
Ensure that you select the same options as shown below, and then click Finish.
As IBM Data Studio builds and deploys the Web service to the
target application server, a progress window is displayed. (The example in this
article uses a simple Web service, which should take less than a minute to
You can click Run in Background
if you expect the deployment of your Web service to take a long time so
that you can continue working on other projects; this makes working in IBM Data Studio asynchronous in nature, which can give
you a big productivity boost when working with large projects or operations.
As you can see, the Deploy Web Service window
has a lot of options:
Use this box to select the target
application server where the Web service will be deployed. Specifically, the Server
radio button defines the actual application server where the Web service
will be deployed. (You can define multiple applications servers of the same
type.) If you have multiple application servers defined in the Servers tab,
you can select the target
application server from the Type drop-down list, as shown below:
Notice that DataPower is an
option? IBM Data Studio Version 1.2
introduced the option to specify the IBM
WebSphere DataPower XML Integration Appliance XI50 as a target Web server when
you are building Web services with IBM
Data Studio. When you specify DataPower as the target for your Web service, IBM Data Studio can only generate deployable XSLT files,
which you can then deploy to the DataPower server outside of the IBM Data Studio. The DataPower option is only supported
for DB2 databases even though IBM DWS
technology supports all mainstream IBM
relational data servers.
If you dont want to deploy and
test the Web service, you can select the Build deployable files only, do not
deploy to a Web server option and IBM
Data Studio will generate a WAR file that you can pass to the Web development
The Data handler box is
used to specify how the data will be handled. The default selection is JDBC.
If you are exposing logic built using the pureQuery API, you would use this drop-down list to declare the
kind of API the Web service is expecting to
use to retrieve the data:
The Register database connection
with Web server check box is available for DB2 data servers, and allows you
to deploy Web services to a target application server without any manual
The Message protocols box
allows you to select check boxes that correspond to the type of Web service you
want to create. For example, if you select REST (Web access) and SOAP over HTTP, IBM Data Studio will generate invocations for both service
styles. IBM Data Studio Version 1.2 added the
SOAP over JMS option, which is well suited for
enterprise-class applications that leverage Java Messaging Service (JMS) for
guaranteed message delivery.
The Parameters box shows
you the parameters that are part of the Web service build. This topic is
outside the scope of this article.
The Test box can be used to configure the type of
test interface that IBM Data Studio starts after
successfully building and deploying the Web service. As of IBM Data Studio 1.2, there are two types of test
clients: the IBM Data Web Services Test Client and
the Web Services Explorer. In IBM Data
Studio 1.1, the only option available was the Web Services Explorer.
The Web Services Explorer window opens.
Test a SOAP
invocation of the Web service as follows:
Expand the WSDL
Main tree and locate the SOA_FEMALEPERSONNELSOAP, as shown in
the previous figure.
Expand the SOA_FEMALEPERSONNELSOAP
group and select FEMALEPERSONNEL Web services and click Go.
(Notice that the Actions box changes when you select this Web service -
compare the Actions box in this step with the Actions box in the
The Status window shows the
results of the invoked Web service:
You can use the scroll bar in the Status
box to see all the results of the Web service.
If you were to run the FEMALEPERSONNEL
SQL statement in your DatabaseJournalProject, you will see that the result of
this query matches the output of the Web service (and it should because the Web
service you just created wraps this very SQL statement):