162 WCTME: Application Development and Case Study
public boolean init(String[] keys, String[] elements);
public String getFlightInfo(String flight);
Local Web Service Client interface
These three lines are the set of methods we want to implement with this client
bundle:
boolean init(Properties properties);
String getFlightInfoAsHTMLTableData(String flight);
String getFlightInfo(String flight);
Our sample application will call the local Web Service client, which will call the
local Web Service. This allows the client bundle to catch any Web Service
exceptions and to format the Web Service information about flight status into the
HTML table data that we want our application to use.
The properties that are passed to the local Web Service are used to configure it.
This includes the destination address of the server side Web Service that our
local Web Service will call if it is not operating in stand-alone mode.
6.4.2 Procedure for creating a Web Service
First we need to create a Bundle Project to hold the Web Service classes.
1. If WebSphere Studio Site Developer is not running, click Start
Programs IBM WebSphere Studio Site Developer 5.1.x.
2. Open the SMF Perspective. Select Window Open Perspective SMF.
3. Make sure you are on the Package Explorer tab. Select File New Other.
4. Select Extension Services Extension Services Bundle Project and
click Next.
5. Enter the Project name FlightInfoWebServiceBundle and click Next.
6. In the Platform Profile field choose Extension Services: jclFoundation
(5.7.0.). See Figure 6-5 on page 163.
Note: The local Web Service init method takes two arrays as the initialization
parameters instead of a Properties object because SMF Web Services do not
easily support complex Java objects.
Chapter 6. Web Services 163
Figure 6-5 Selecting the Web Services application service
7. Select the application services Web Services using Proxy Services check
box. Click Next. See Figure 6-6 on page 164.
164 WCTME: Application Development and Case Study
Figure 6-6 Selecting other projects for this project’s build path
8. Click the Projects tab and select the check boxes next to
ITSOCustomerBundle and ITSORentalsDatabaseServiceBundle. Click
Next.
9. Select the check box next to Create Default Bundle Activator. Click Finish.
10.If you see a panel indicating the folder has changed, click Yes.
11.From the Package Explorer tab of the SMF Perspective, selected the
FlightInfoWebServiceBundle Project you just created and right-click. From
the pop-up menu select New Package.
Chapter 6. Web Services 165
12.Enter the package name com.itso.flightInfo and click Finish.
13.Select the package just created, right-click. From the pop-up menu select
New Interface.
14.Enter the name FlightInfoWebService and click Finish.
15.Into the FlightInfoWebService.java window that opens, copy the following:
public boolean init(String[] keys, String[] elements);
public String getFlightInfo(String flight);
16.Save the file.
With the next few steps, we generate the Web Service client to the server side
Web Service. See Appendix C, “Sample server-side Web Service” on page 375
on building a Web Service.
See the Additional Materials appendix for instructions on how to download a
sample version of the server side Web Service. To complete the next few steps,
you can run that service side Web Service locally.
Tip: To help remove unresolved compiler errors, right-click in the source and
select Source Organize Imports.
Attention: Before completing the next section, make sure the server-side
Web Service is running. Open a browser and point it to:
http://webservice_host:9080/DelayedFlightsWS/services/DelayedFlights/wsdl/
DelayedFlights.wsdl
In this example, webservice_host is the host name of your Web Service host,
and 9080 is the real port on which the service is running.
The browser should show the wsdl for the Web Service.
Note: If you will not be running the sample program with a real Web Service
server, you can skip some steps and you will need to comment out some code
in the local Web Service that calls the server-side web service.
Skip steps 17 and 18, the generation of the local client stub to the remote web
service.
In step 21, comment out the reference to the private
DelayedFlightsSoap_Stub stub that was not generated in steps 17 and 18.
Also comment out any code that uses this stub.

Get IBM Workplace Client Technology Micro Edition Version 5.7.1: Application Development and Case Study now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.