Creating a Portal Service

Prerequisites

Context

A portal service provides functionality to portal components, other portal services and other applications.

Procedure


  1. Start the Portal Application Object wizard by right-clicking the portal application project and then selecting Start of the navigation pathNew Next navigation step Create Portal Application ObjectEnd of the navigation path.

  2. Select the portal application project in which to add the portal service, and then click Next .

  3. Select Portal Service , and then click Next .

  4. In the Portal Service window, enter the following:

    1. Name: The name of the portal service. This value is automatically added to the portalapp.xml file for the portal application.

    2. Class Name: The name of the Java class created for this portal service. Generally, the portal name and the class are the same.

    3. Package Name: The name of the package for the newly created Java class. This field is optional.

  5. Click Finish . The following items are created automatically:

    • A Java interface that extends IService is created in the src.api folder. The interface defines a constant for the service key.

      The name of the interface is the name of the service, preceded by an I .

    • A Java class that extends the new Java interface is created in the src.core folder. The class contains default implementations for all the methods defined by IService .

    • A <service> element for the new service is added to the portalapp.xml file of the portal application.

  6. In the interface, set the service key constant ( KEY ) to the fully qualified name of the service, which is the name of the application, a period, and the name of the service.

    For example, if you defined an portal application called myApp and a service called myService , the fully qualified name of the service would be myApp.myService .

  7. Add custom methods for the service:

    1. Define the methods in the interface.

    2. Implement the methods in the implementation class.