Top
Interstage Studio User's Guide
FUJITSU Software

D.3.2 Creating the Web Service

Create the Service Endpoint Interface, and then use the Web service wizard to create the files required for the Web service application.

Creating a Service Endpoint Interface

Create an interface in Java for a service to be made publicly available as a Web service.

From [New] wizard, select [Interface] and create the Service Endpoint Interface.

The service endpoint interface must satisfy the following conditions:

Note

When defining a method, comply with the range of data types that can be used. For details on the data types that can be used, refer to the "Interstage Application Server J2EE User's Guide".

Generating the files required for a Web service

You can use the Service Endpoint Interface to create files required for creating a Web service. From [New] wizard, select [Web Service] > [IJServer] > [Web Service (JAX-RPC)] and use the wizard to create the files. See below for the wizard settings.

[Service endpoint related information] page

Option

Description

Source folder

Specify the destination folder for the implementation template class to be created.
The WSDL file, deployment descriptor, and other elements will be created under ContextRoot in the project to which the specified source folder belongs.
A source folder included in a project cannot be specified as anything other than an Enterprise JavaBeans project with version 2.1 Web Application Project or Enterprise JavaBeans.

Service end point interface name

Specify the fully qualified name of the service endpoint interface to be made open for the Web service.

The specified service endpoint interface must satisfy the following conditions:

  • java.rmi.Remote must be extended.

  • java.rmi.RemoteException must be specified in the throws clause of each method.

  • Methods must not be overloaded.

Implemented template class

Specify information on the implementation template class.
This cannot be specified if the project specified in [Source folder] is an Enterprise JavaBeans Project.


Package

Specify the package for the implementation templates to be created.
The name of the package of the service endpoint interface is displayed by default. If the package for the template differs from the package of the service endpoint interface, change the displayed name.

Implemented template class name

Specify a name for the implementation template class to be created.
The service endpoint interface name followed by the character string "SOAPBindingImpl" is displayed by default.

Not overwrite

To prevent overwriting of an existing implementation template class, select this option.

[WSDL file related information] page

Option

Description

WSDL file name

Indicates a name for the created WSDL file, using a path relative to ContextRoot.

style attribute/use attribute

Specifies a combination of the style attribute and use attribute for writing to the WSDL file. One of the following combinations can be specified:

  • DOCUMENT/LITERAL

  • RPC/ENCODED

  • RPC/LITERAL

To satisfy the requirements in WS-I Basic Profile 1.0, specify DOCUMENT/LITERAL or RPC/LITERAL.
DOCUMENT/LITERAL is more suitable for program communication. Use DOCUMENT/LITERAL, which is our recommendation and is more widely used, unless you have a reason not to use it.
RPC/ENCODED is a combination that was widely used before WS-I Basic Profile 1.0 was established. If an RPC/ENCODED-based connection is required, such as when a connection must be established to a system that uses an old SOAP service, use RPC/ENCODED.

Location information

Specifies the endpoint URL used to access the Web service.
This value depends on the operating environment. The default value is set to check the operation in combination with a client in the local environment.

Attached file

Specifies how to create a WSDL to develop an application that handles attached files in a Web service. One of the following two methods can be selected:

  • WSDL file is created conforming to WS-I Attachments Profile 1.0

  • WSDL file is created using a specific data type

To create a WSDL file conforming to WS-I Attachments Profile 1.0 by using the attached files, specify [WSDL file is created conforming to WS-I Attachments Profile 1.0] by using the javax.activation.DataHandler class with a service end-point interface. If the following classes used in the attached files are used when [WSDL file is created conforming to WS-I Attachments Profile 1.0] is specified, a creation error occurs:

  • java.awt.Image

  • javax.mail.internet.MimeMultipart

  • javax.xml.transform.Source

If a class other than the javax.activation.DataHandler class is used, conversion from binary data to a Java object prevents the original file data from being completely retained. Therefore, the recommended class for use is the javax.activation.DataHandler class.

Note

Before you can use the Web Service wizard, the Interstage Application Server function or Interstage Application Server client package must be installed.
Since the Web Service(JAX-RPC) wizard examines a class file (.class) to acquire required information, the service endpoint interface must be compiled before activation of the wizard.

Point

  • In the initial workbench state, options are configured such that a build is automatically performed when a file is saved. If no compile error occurs in the process of saving the service endpoint interface, there is no problem.

  • If you choose the service endpoint interface in Project Explorer when starting the Web service wizard, the wizard service endpoint interface name and other input items are set as initial values.

The table below lists files created by the Web Service wizard.

Created file

File name

Description

Web service endpoint

<Service-endpoint-interface-name>SOAPBindingImpl.java

Defines the service endpoint interface implementation class. A Web service implementation is defined in this class.

The file is created in the source folder and identified from the package and name specified with the wizard.

WSDL file

<Service-endpoint-interface-name>.wsdl

Contains a Web service interface definition.

The file is created at the level immediately below ContextRoot/WEB-INF/wsdl.

deployment descriptor

webservices.xml

Contains Web service deployment information.

The file is created at a level below ContextRoot/WEB-INF. (If an existing file has the same name, this information is added to the existing file.)

web.xml

Contains WAR file deployment information.

The file is created at a level below ContextRoot/WEB-INF. (If an existing file has the same name, this information is added to the existing file.)

Other file

<WSDL-file-name>_mapping.xml

Automatically generated file required for running a Web service.

The file is created at a level below ContextRoot/WEB-INF.

Point

For the rules used during file creation regarding conversion from the Java type to an XML type for WSDL, refer to the "Interstage Application Server J2EE User's Guide".

Editing WSDL files

Use a WSDL editor to edit WSDL files. For details on WSDL editors, refer to "WSDL Editor".

Validating the propriety of a WSDL file

The following validator is provided as a WSDL propriety validation tool:

To execute this validator during build, select the [Validation] builder, and then enable execution of the validator in the [Validation] properties. In the general settings, execution of this validator is enabled.

You can use the above validator for validation even when no build is in progress, by selecting [Validate] from the context menu with the target resource selected.

Editing Deployment Descriptors

To edit the deployment descriptors below, use an XML editor (for details on XML editors, refer to "Editing XML Files"):

Implementing a Web service application

Implement your Web service application. Write the Web service implementation code in the Web service endpoint file created by the wizard.

Normally, you need not edit the other created files. If you need to edit any of these files, make sure you have a good understanding of the file. For details on each file, refer to the "Interstage Application Server J2EE User's Guide".

Point

If the service endpoint interface uses a Holder class, parameters are treated as INOUT parameters. To treat parameters as OUT parameters, edit the WSDL file.