Introduction
Why use J2SE clients to access Web services?
Jave 2 Standard Edition (J2SE) provides a great set of tools to build a rich graphical user interface (GUI). Unfortunately, client-server model J2SE programs have historically come with a lot of baggage:
- They were diffcult to deploy.
- They consumed lots of database server resources with their Java Database Connectivity (JDBC) driver connections.
- They relied on the database server security model or required an application-wide password on the client machine to use application-specific security.
Java Web Start and Web services enable a new application architecture with the rich GUI of a so-called fat client without the headaches. Java Web Start takes care of all the installation, deployment, and update problems over the Web. Web services technology takes care of the database server resources by concentrating database connections for hundreds of users in the Web service. Security models are simpler because the Web service logic is now able to use any resource available to a Java program running in the server environment.
Take this tutorial if you want to learn how to connect a J2SE client to Web services running on an IBM(R) WebSphere(R) Studio platform or you just want to learn how to deploy a J2SE client from WebSphere Studio using Java Web Start.
Like all practical tutorials, this one starts with real-world requirements for a manufacturing client. The gist of the application shows machine and employee work schedules at a micro-level. The application replaces magnets and printed cards on a white board. Key technical requirements are:
- Ensure that the application can continue to display schedules even if the server is inaccessible for a period of several hours.
- Provide for centralized, unattended deployment to any authorized user.
- Read and update data in an IBM iSeries Server database.
- Use only currently supported server technologies to delay the application becoming out-of-date.
- Develop the application within the Websphere Studio Application Developer environment for ease of future maintenance.
The first two requirements suggest the use of a Java 2 Standard Edition (J2SE) client with Java Web Start technology. The J2SE client can safe-store data on the client computer during server outages. Java Web Start provides for centralized, automated deployment. The third requirement suggested two alternative client-server architectures -- Java Database Connectivity (JDBC) and Web services. Both architectures have been deployed in this client environment, with greater success using Web services. One application runs on Sharp Zaurus Personal Digital Assistant (PDA) devices using KSoap for XML parsing. The other Web services application uses Apache Axis on both client and server to implement remote method invocation. The client is a J2SE client which is also used in stand-alone mode.
Research into the iSeries Websphere Sudio platform indicated that the Apache Axis Web service implementation would not be supported in the future, and that new Web service development should use the Web Service 5.0.2 WS-I standards. The fourth requirement mandated the use of the 5.0.2 WS-I standards. Initial testing within the development tool showed great promise for a smooth development path until the first test deployment. Unfortunately, a J2SE client developed using the IBM WSDK V5.1 tools will not run as a standard client outside of a J2EE container. Implementing a full-blown J2EE application client was ruled about because of the complexity of J2EE technology for a simple white board application. In addition, the J2EE standard of configuring the client from the server violated the first requirement to display data after client restart without use of the server.
Is there a way to use a different implementation of Java Web Services to inter-operate with the iSeries Server? Yes, the Sun Java Web Services Developer Pack contained different implementations of J2SE client code generation and run-time libraries which will inter-operate with the Websphere Application Server. This tutorial will guide you through all the steps to create and deploy Web services and J2SE clients using both IBM and Sun tools to build Java Web Start applications which inter-operate with IBM Websphere Application Server Test Environment inside IBM Websphere Studio Application Developer.
The goal of this tutorial is to reveal the nitty-gritty details of using Java 2 Standard Edition (J2SE) clients, deployed with Java Web Start (JWS), to access Web services running on Application Server. These revelations show how to:
- Build Web services from Java Beans in Application Developer
- Change your Device Developer environment to use JSDK 1.4.x while retaining the ability to run the original IBM J2SDK version 1.3.
- Use Sun's Java Web Services Developer Pack (JWSDP) to generate J2SE client artifacts from an IBM Web services deployment language (WSDL) file.
- Prepare and deploy the J2SE client using JWS from the Application Server.
Before beginning this tutorial, you should understand Java programming, the Device Developer development environment, and Web services architecture concepts. This tutorial was developed on a Windows XP workstation and assumes development and deployment in Windows environments. On other platforms, your mileage may vary. Your development workstation should have the following installed components:
- Sun's Java 1.4.2 or greater Java 2 Software Development Kit (J2SDK) from java.sun.com. For smooth operation of Ant build tasks, be sure to install the J2SDK into the root of your C: drive. Do not accept the default of installing under the Program Files directory.
- Sun's Java Runtime Environment (JRE) on the client computer to match the J2SDK. The installation of any Java 1.4 JRE on a client computer should install the Java Web Start client. The server and client computer can be the same machine.
- IBM Web Services Development Kit Version 5.1 (WSDK 5.1) from IBM developerWorks.
- Sun's Java Web Services Developer Pack Version 1.3 (JWSDP 1.3) from java.sun.com.
During this tutorial, you will create a simple set of Web services to test inter-operability. The sample services implement both simple and complex request and return types in order to demonstrate practical use of Web services technology. In the interests of simplicity, you will generate the Web services for this tutorial from simple Java beans with no database access.
The work for this tutorial will be done in two workspaces -- one using Java SDK 1.3.1 as shipped by IBM and one Device Developer workspace using Sun's Java SDK 1.4.2. Two workspaces are required because each vendor's Web services tooling requires its expected run-time environment. The use of two workspaces means the running of two separate Device Developer processes.
Now that you have everything you need, select your favorite starting point from:
- From Beans to Web services
- Changing the Device Developer Java SDK
- Build a J2SE WSI Client
- Deploy the client with Java Web Start

