Level: Introductory Paul Pacholski (pacholsk@ca.ibm.com.), Worldwide Technical Sales Consultant for WebSphere Tools, IBM
18 Apr 2002 This article describes how to use IBM WebSphere Studio Application Developer to discover and evaluate Web services. You will learn how the Application Developer Web services tooling makes the discovery and evaluation of Web services quick and simple.
Introduction There are many useful Web services available today from a
multitude of UDDI Business Registries and other UDDI compliant repositories.
The task of discovery and evaluation of Web services can be complex and often
may require writing code. This deters many programmers from using Web services
in Web applications. This article describes how to use IBM ® WebSphere® Studio
Application Developer to discover and evaluate Web services. You will learn
how the Application Developer Web services tooling makes the discovery and evaluation
of Web services quick and simple. The discovery and evaluation of a Web service with Application
Developer requires four easy steps (actually three if you do not count the initial
setup):
- Setting up WebSphere Studio Application Developer
- Connecting to UDDI compliant registry
- Discovering and importing the Web services into Application
Developer project
- Testing the Web service
The only product used in this paper is IBM WebSphere Studio
Application Developer, Version 4.0.3 for Windows®. No familiarity with the basic operations of Application Developer
is required to follow the procedures described below.
Step 1. Setting up WebSphere Studio Application Developer
- Install WebSphere Studio Application Developer.
- Start WebSphere Studio Application Developer.
- Create a Web and EAR (Enterprise Archive) projects.
We will now create a Web project which we will use to download WSDL files
and conduct unit testing and evaluation of the Web services. We will also
create an EAR project required to deploy our unit test Web application (Test
Client) to WebSphere v4.0 Test Environment.
- Click Open Perspective
,
located on the vertical Perspective toolbar, to open Web Perspective.
- To create Web and EAR projects, from the main toolbar, click Create
a Web project
.
- On the Define the Web project page enter WebServicesEvaluation
for the project name and WebServicesEvaluationEAR for Enterprise
Application project name. See Figure 1 below.
Figure 1. Defining Web project

- Click Finish to create the Web and EAR projects.
Step 2. Connecting to a UDDI compliant registry The UDDI Explorer tool in Application Developer enables you
to discover or register a Web service in UDDI-complaint registries. Any UDDI
V1 and V2 compliant repository can be accessed using UDDI Explorer. In this article, we will access the
XMethods Web services repository.
XMethods has a large collection of Web services from many providers. XMethods' UDDI V1
and V2 compliant interface allows inquiry and retrieval operations only.
- Launch IBM UDDI Explorer.
- Select the WebServicesEvaluation Web project.
In the steps to follow, you will be importing the Interface WSDL file
(of the Web services you will discover) into the root directory of the
WebServicesEvaluation Web project.
- From the main menu select File => Import.
- On the Select page, select UDDI and click Next.
- In UDDI Import page, click Finish. This will launch the IBM UDDI
Explorer tool.
After a few seconds, you should see a Web browser window
running the UDDI Explorer Web application. See Figure 2 below.
Figure 2. IBM UDDI Explorer

- Connect to XMethods UDDI business registry.
- Click on the UDDI Main link in the UDDI Navigator frame.
- In the Actions frame, enter XMethods for registry name and http://uddi.xmethods.net/inquire
for Inquiry URL.
- Click Go. An XMethods entry will be added under the UDDI Main tree.
- Click on XMethods link in UDDI Navigator frame. See Figure 3 below.
Figure 3. XMethods UDDI business registry

- To save this link for future use, click on Add to favorites
in the Actions frame toolbar.
 |
Step 3. Discovering and importing the Web services into Application
Developer project In this step, you will search for a Web service based on its
English description. Before we delve into the details of discovering a Web service,
let's examine the three different ways you can discover Web services with the
UDDI Explorer. The first one, Find Business Entities (as shown in Figure 4 below),
is recommended when you know the business entity and you want know what Web
services that business entity provides. The second one, Find Business Services,
lets you find a Web service (and its interface WSDL file) by its English description.
It searches the Web service descriptions in all registered business entities.
Finally, Find Business Interface is equivalent to Find Business Services, except
that it finds the Service (also known as the Binding) WSDL file, not the Interface
WSDL file.
- Discover a Web service.
Suppose we are interested in Web services that provides mortgage payment calculations
and we do not know or do not care what the Web service provider is. With IBM
UDDI Explorer the task of finding a Web service based on its description is
simple. Let us use the Find Business Services function.
- Click on Find Business Services link in UDDI Navigator frame.
Figure 4. Finding Business Service

- In Actions frame, enter %mortgage for service Name and click Go
(% is the UDDI search wild card character). Wait a few moments for UDDI
Explorer to search the XMethods Web services repository and return the following
results in the query results folder.
Figure 5. Query Results

One match was found: the Monthly Mortgage Payment Web
service.
- Import Web service into Application Developer project.
- In the UDDI Navigator frame, click on Monthly Mortgage Payment
link under query results folder.
- In Actions frame:
- Make sure the Web project is WebServicesEvaluation.
- Change the WSDL file from
temp.wsdl to MortgagePayment.wsdl.
- Click Go to import it into Application Developer.
Figure 6. WSDL Import Details

 |
Step 4. Testing the Web service You have just downloaded the service WSDL file (MortgagePayment.wsdl)
into the root directory of the WebServicesEvaluation project. See Figure 7 below. Figure 7. Imported WSDL File

In the next two easy steps you will generate a Test Client
and evaluate the Monthly Mortgage Payment Web service to see if it fits your
requirements. 1. Creating Web service Client
- From the Navigator pane, select the
MortgagePayment.wsdl
file, right-click and select New => Other.
- In Select window, select Web services from left pane and Web service
client from the right pane and then click Next.
- In Web service Client window, select:
- Generate a sample check box.
- Launch the sample check box.
Figure 8. Web service Client Wizard Settings

If you specify a different file every time you import a WSDL file, you do
not need to check Overwrite files without warning.
- Click Finish. Wait for the Web services client wizard to exit; this
may take a few moments.
Now let's examine what code was generated. JavaTM Proxy class: Figure 9. Java Proxy

It is used in the Test Client Web application to interact
with this Web service. You can use the Java Proxy class later on in your own
code to invoke this Web service. Test Client Web application: Figure 10. Test Client

You will use this generated Test Client Web application to
test the Web service in the next step. Server project with WebSphere Server Instance and Configuration: Figure 11. WebSphere Server Instance and Configuration

This Server Instance and Configuration is used to run the Test Client Web application. The name of the Java Proxy (MortgagePayment) and the subdirectory
for the Test Client Web application were named using the WSDL file name specified
in Step 3.2.b. This makes it possible to use the same Web project for downloading
and testing multiple Web services! 2. Testing and Evaluating the Web service Application Developer has switched to the Server Perspective,
and the Test Client Web application generated by the Web services client wizard
has been started for you. You are now ready to test and evaluate the Web service. Figure 12. Web services Test Client

- In the Methods pane, click on CalculatePayment link. This link represents
the operation offered by this Web service.
- Now the Inputs pane shows the parts of the request message of the CalculatePayment
operation. Enter the required input data as shown in Figure 13 below.
Figure 13. Web services Test Client - Input Pane

- Click Invoke to invoke the CalculatePayment operation of this Web
service. You should now see the results in the Results pane as shown in Figure
14 below.
Figure 14. Web services Test Client - Result Pane

Conclusion IBM WebSphere Studio Application Developer makes discovery, evaluation and testing of Web services easy. The IBM
UDDI Explorer tool enables the discovery and import of Web services registered in any UDDI V1 and V2 compliant
Web services repositories. The powerful Web Service client wizard performs all programing tasks required to evaluate
Web service, including a generation of a Test Client web application that can be used to unit test a Web service.
Since the entire procedure can be accomplished in minutes rather than hours, Application Developer is an ideal tool
when a large number of Web services needs to be evaluated. A follow-on article (Web Services Programming with WebSphere Studio Application Developer - Part 2)
will be published soon. It will discuss some common WSDL-related problems that you may encounter when testing a Web
service, and introduce some techniques to overcome these problems.
About the author  | 
|  | Paul Pacholski is a technical sales consultant supporting WebSphere development tools with special focus on Web services. You can reach Paul at pacholsk@ca.ibm.com. |
Rate this page
|