Top
Interstage Studio User's Guide
FUJITSU Software

9.5.1 Overview

9.5.1.1 What is a Web Service?

Refer to "5.1.1 What is a Web Service?" for an outline of Web services.

9.5.1.2 Changes from Java EE 5

JAX-RS1.1 is included in Java EE 6.

By using JAX-RS1.1, Representational State Transfer (REST) type Web applications can easily be developed.

By using annotations in JAX-RS1.1, the Java resource path can be specified to easily bind the Java method to the HTTP request method.

Annotations

Use annotations to define classes to run as REST type Web applications.

The following shows annotations example:

Example of creating a REST type Web application using annotations

@Path(value="/root")
public class RootResource {
    @GET
    public String getName() {
        return "name";
    }
}

Point

Refer to the following specifications for details on JAX-RS 1.1:

  • JSR-311: JAX-RS: The Java(TM) API for RESTful Web Services

Refer to the following specifications for details on JAX-WS 2.2:

  • JSR 224: Java(TM) API for XML-Based Web Services (JAX-WS) 2.2

9.5.1.3 Developing Web Service Applications

Refer to "5.2.2 Development Flow" and "5.2.3 Development Procedures" for information on the flow and procedures for developing Web service applications. Refer to "9.6.1 Preparing to Create Applications" for information on preparations for creating annotations.

Note

In the Java EE 6 workbench, the Service Endpoint Interface is generated from WSDL using the ijwsimport command.

  1. Open the command prompt create the working folder.
    Example: mkdir temp

  2. Change to the working folder.
    Example: cd temp

  3. Create the source output destination folder.
    Example: mkdir src

  4. Use the ijwsimport command to generate the required source for the Web service client to the working folder.
    ijwsimport -p <packagename> -s <sourceoutputfolder> -keep <WSDL URL (Uniform Resource Locator)>
    Example: ijwsimport -p stub -s src -keep http://localhost:28282/WebServiceSample6/PopulationRankingService?wsdl

  5. Copy the source files of the <source output folder> in 4 to each package folder in the Web service client project source folder. The WSDL files are unnecessary.

  6. Select the Web service client project, then press the F5 key.

  7. Delete the working folder.

If an error was detected in the source files that were added in 5 and 6 above, use the following procedure to set the build path:

  1. Select the Web service client project, then select [Properties] from the context menu.

  2. Click the [Java Build Path] > [Libraries] tabs, then add the following JAR files in [Add External JARs]:
    <installation folder>\APS\F3FMisje6\glassfish\modules\endorsed
    <installation folder>\APS\F3FMisje6\glassfish\lib\endorsed

  3. In the [Order and Export] tab, move the JAR files that were added in 2 above [JRE System Library] then click [OK].

Refer to "Deploying and Obtaining/Storing WSDL" in "Developing Web Service Applications" in the "Interstage Application Server Java EE Operator's Guide (Java EE 6 Edition)" for details on the ijwsimport command and WSDL URL.

Point

Refer to "How to Create JAX-RS Applications" in the "Interstage Application Server Java EE Operator's Guide (Java EE 6 Edition)" for details on creating JAX-RS applications.