Web services use a complex architecture to provide a simple mechanism for client applications to invoke methods and obtain results from server applications, regardless of the language used by the source code and the host platform. The tools provided by Sun One studio allow developers to use Web services and methods that are contained in existing Java classes without having a deeper understanding of the architecture. This article creates a Web service from a servlet-based Web module that demonstrates how to use existing service logic to generate new client applications.
Introduced
Review the core technologies of Web services--xml and Simple Object Access Protocol (SOAP)--it is clear that these technologies have been in the industry environment for many years. During this time, the tools to build, test, and deploy Web services have matured considerably. The depth of understanding of these key technologies-such as the structure of the SOAP envelope-is a prerequisite in the previous period. Now, with advanced development tools like Sun One studio, a Web service can be built in minutes from an existing Java EE Web container application-without the need for a Web services technical background like soap.
This article simulates a common case: using an existing service based on the Java EE Web container application, and presenting it as a point-to-point synchronization integrated Web service after the firewall. When using an example that is not a real application, its simplicity provides an opportunity to centrally create, deploy, and test the processing of a Web service that is shared by most comprehensive Java-EE applications. Related topics such as security and transactions are important, but are beyond the scope of this tutorial.
Initialize setup tasks
In order to successfully follow the procedures in this article, you must set up a similar development environment. This environment includes the Sun one Studio 4 Enterprise Edition and the Sun one application Server 7 platform version.
Product and file downloads
The following table outlines the product and file downloads that are required in this tutorial.
Products/Documents |
Annotations |
Sun one Studio 5 Standard Edition |
The Sun one Studio 5 standard version is preconfigured with Sun-Application Server 7, an application server that this article needs. If Sun one application Server 7 is already installed in your development environment, then sun one Studio 5 will be automatically consolidated into an existing installation. |
Hellowebmod.zip |
HelloWorld source program in a Web module two source files used in this tutorial: Helloworld.java Hello Package Entry class for servlet based Web container applications. All two class files are in the Com.sun.demo.hello package. Salutation.java This is a simple class that contains a method to use as a Web service. |
Viewing file extensions
By default, the IDE hides the extension in the Explorer window, but for reasons of clarity, this article includes the file name extension. To make the file name extension visible, you can selectively perform the following tasks:
1. From the IDE main menu, select tools> Options to open the Options window.
2. Open the IDE's configuration > system and select System Settings.
3. Set the show File extensions property to True.