Introduction
In the real world of business, all of a company's systems do not always come from a single vendor. The best-of-breed approach, in which organizations select the best tool for each specific job, makes more business sense, as it offers more flexibility to fit the different needs of a company. Often organizations will have servers running remotely and one or more clients talking to those servers. For instance, a company might have WebSphere Application Server running on an Unix box and multiple clients running on Windows machines using WebSphere Studio as a development environment. Some smaller companies with limited budgets might run WebSphere Studio on Windows clients but run other application servers, like JBoss, on Linux hardware at the server end.
Vendor-independent software development is crucial to ensure that companies have cost-effective integration that meets their needs and does not limit their choice of system configurations. The Web services model's loose coupling is the key to flexible, inexpensive integration capabilities. Web services clients and servers are totally separate components, potentially supporting different runtime protocols and running on different servers. The WebSphere Studio Web Service wizard provides us with all the necessary tooling to deliver such vendor-independent Web service solutions.
This tutorial demonstrates how to use IBM WebSphere Studio Application Developer Version 5.1.1 (hereafter just called WebSphere Studio) to generate a Web service from a JavaBean component using Apache Axis as the server runtime. (Since Web services are a relatively new concept, developing a new Web service for an existing application - the "bottom-up" approach - will likely be the least expensive. That's why we'll be using a JavaBean component as the basis of our service.) You'll also learn how to generate the client proxy using WebSphere Application Developer V5.1 as a client runtime, and see a sample application that tests the Web service using the WebSphere Test Environment. The tutorial then shows you how to deploy the application onto the open source JBoss application server (version 3.2.1 integrated with Tomcat Version 4.1.12) by using WebSphere Studio's J2EE Publishing Server, and invoking the Web service from WebSphere Studio.
The Web service you'll build will have the following features:
- The Web service client runtime can be the same as or different from the server application runtime.
- The Web service client and server have different EAR files.
- The Web service server application will be deployed to a remote server, such as JBoss.
- The Web service client and server run on different J2EE servers - for instance, the client could run on IBM WebSphere and the server on JBoss.
Our tutorial's Web service, called the Body Mass Index service, will calculate your body mass index based on the height and weight you enter, and return a weight status (Overweight, UnderWeight, Normal, or Obese) in a string. You will also generate the client proxy and sample application using WebSphere Studio's Web services wizard and test it in the WebSphere runtime test environment.
You will test the generated proxy using Web service JSP pages. The proxy can be launched in a Web browser at the following URL:
http://localhost:port/WebProjectClient/sample/ WebServiceProxyName/TestClient.jsp |
You can use this sample application to test the Body Mass Index Web service by selecting the method bmindication(), entering values for the parameters weight_in_pounds and height_in_inches, and clicking Invoke. The weight status string result will be displayed in the results pane of your browser.
Then we will configure the server and deploy the Web service using WebSphere Studio's J2EE publishing server, and run it on the JBoss server. By switching the endpoint of the Web service via the sample Test Client application, we can test the Web service on the JBoss server.
After completing the tutorial, you will know how to efficiently use WebSphere Studio tools to develop, test, deploy, publish, and discover a Web service. Along the way, you'll pick up some extra tips and tricks on what to do for a Web service that has different client and server runtimes. You'll also learn how you can easily deploy Web services using WebSphere Studio's J2EE Publishing Server tools with other J2EE-compliant servers, and to easily switch inside WebSphere Studio to test Web services with different servers.
You don't need to be familiar with Web services programming to take this tutorial, but you should have Web application development experience. You should also know basic Java language programming. Previous experience with WebSphere Studio would be helpful but is not required.
Here are the system configurations for the client and server runtimes we will use in this tutorial:
- Client runtime: WebSphere V5, running on the WebSphere Studio 5.1.1 server test environment
- Server runtime: Apache Axis 1.0, running on the JBoss server
The image below illustrates our setup:
Figure 1. System configuration
You can have these two runtimes on the same machine or different machines, depending on your preference. Since the client and server runtime are different, we will create one Web project for the client and another for the server. There will be two EAR files as well, one for client and one for server. This will make the application more portable.
The J2EE Publishing Server is one of the features of the server toolset in WebSphere Studio Application Developer Version 5.0. This new server type lets you develop J2EE applications, deploy them to remote J2EE-compliant servers that require minimal configuration (such as Apache, Tomcat, or JBoss), and then test the client applications from the WebSphere Studio workbench.
Figure 2. Sample code
In this tutorial, you will create and configure the J2EE Publishing Server so that you can deploy the Body Mass Index Web service to the JBoss application server. In the Download section, you will find a link to ws-j2eewscode.zip; this contains the Java source file for the Body Mass Index JavaBean component.
You should download it to a drive on your computer. A folder called BMISource will be created when you unzip it.

