Creating a Web Service with the Wizard

You can create a Web service with the wizard that will guide you through the creation of the component. The wizard is invoked from a class diagram and is only available if you use the Java or the .NET family.

You can either create a Web service without selecting any class, or use the standard approach that consists in selecting an existing class first and then start the wizard from the contextual menu of the class.

You can also create several Web services of the same type by selecting several classes at the same time. The wizard will automatically create one Web service per class. The classes you have selected in the class diagram become Web service classes, they are renamed to match the naming conventions standard, and they are linked to the new Web service component.

Note: You must create the Web service component within a package so that the package acts as a namespace.

The wizard for creation of Web services lets you define the following parameters:

Property

Description

Name

Name of the Web service component

Code

Code of the Web service component

Web service type

Interface or Implementation. Interface refers to a component that defines the service interface only. Implementation refers to a component that implements a service interface

Component type

The component type depends on the web service type. You can select among a list of web service interface or implementation protocols

Web service implementation class

Defines the class that is used to implement the Web service

Create symbol

Creates a component symbol in the diagram specified beside the Create symbol In check box. If a component diagram already exists, you can select one from the list. You can also display the diagram properties by selecting the Properties tool

Create Class Diagram for component classifiers

Available only for stateless session beans and servlets. It creates a class diagram with a symbol for each class and interface. If you have selected classes and interfaces before starting the wizard, they are used to create the component. This option allows you to display these classes and interfaces in a diagram

  1. Select Tools > Create Web Service Component from a class diagram.

    The Web Service Wizard dialog box is displayed.



  2. Type a name and code for the Web service component and click Next.
    Note: If you have selected classes before starting the wizard, some of the following steps are omitted because the different names are created by default according to the names of the selected classes.

    When you create a Web service with the wizard, you have to select the type of the Web service and the type of the component that is used as a source. The following table maps available component types to Web service types in Java:

    Component type

    Java service interface

    Java service implementation

    Use

    Standard

    Java class

    Axis RPC

    Java class

    Axis EJB

    EJB Stateless Session Bean

    Java Web Service (JWS)

    Java class with .jws extension

    JAXM

    Java Servlet

    JAX-RPC

    Java class

    Web Service for J2EE

    EJB Stateless Session Bean

    = allowed

    — = not allowed

  3. Select a Web service type and a component type and click Next.
  4. Select a Web service implementation class and click Next.
  5. At the end of the wizard, you have to define the creation of symbols.

When you have finished using the wizard, the following actions are executed:

  • A Web service component flagged as 'Web service' is created

  • A Web service implementation class is created and visible in the Browser. It is named after the original class if you have selected a class before starting the wizard. If you have not selected a class beforehand, it is prefixed after the original default component name to preserve coherence

  • A default operation with the "Web method" flag is created

  • Depending on the component type, required interfaces associated with the component are added