4.3 Creating a Service Resource

There are two ways to create a service resource for use with a custom component:

4.3.1 Creating a Custom Service Manually

To create a custom service resource manually:

4.3.2 Define the service in an HTM file

The HTM file must include a table that is identical in structure to the StandardServices table. See "Service Structure Overview".

Make a copy of the std_services.htm file, place it in your custom component's resources directory, and rename the file to avoid confusion. For example:

  1. Change the name of the StandardServices table to a new name. For example:

    <@table MyServices@>
  2. Delete all of the rows in the table except for a service that is similar to the one you want to create.

  3. Edit the entries in the Name, Attributes, and Actions columns.

  4. Save and close the file.

For example, the following HTM file shows two custom services named ADD_REPORT and REPORTS_LIST:

Here is an example of a custom services HTM file, displayed in a text editor.

<META HTTP-EQUIV='Content-Type' content='text/html; charset=iso-8859-1'>
<TITLE>Custom Scripted Services</TITLE>
<@table MyServices@>
<table border=1><caption><strong>Scripts For Custom Services
Unable to add report.</td>
Unable to retrieve reports.</td>

Figure 4-5 Example of Custom Services HTM File, Displayed in a Web Browser

Surrounding text describes Figure 4-5 . Load the service in the custom component HDA file

  1. Open the component definition (glue) file of the custom component in a text editor. For example, DomainHome/ucm/cs/custom/my_component/my_component.hda.

  2. Add the new HTM file to the ResourceDefinition ResultSet. For example:

    @ResultSet ResourceDefinition
  3. Save the file.

4.3.3 Creating a Custom Service using Component Wizard

To create a service resource using the Component Wizard:

  1. In the Component Wizard, open the component the resource will be created for.

  2. On the Resource Definition tab, click Add.

    The Add Resource screen is displayed.

Figure 4-6 Defining a New Custom Service

Surrounding text describes Figure 4-6 .
  1. Select the Service option.

  2. Enter the file name for the resource file. The default file name is resources/componentname_service.htm.

    If a resource file has been created for services, you can append the new service table to the existing file by selecting the file name. Any changes you make to the load order will apply to the entire resource file.

    To create a new resource file with a different file name, enter the file name. For example, my_services.htm.

  3. If you want the new resource file to be loaded in a particular order, enter the number in the Load Order field.


    Unless you have a particular reason for the resource file to be loaded after other resources, you should leave the load order set to 1.
  4. Click Next.

    The Add Service Table Information screen is displayed.

Figure 4-7 Defining a New Service Table

Surrounding text describes Figure 4-7 .
  1. Enter a name for the service table.

    It is a good idea to leave the name of the component as a prefix. For example, My_Component_Services.

    Each service table in a component must have a unique name, even if the tables are in different resource files.

  2. Click Next.

    The Add Service screen is displayed.

Figure 4-8 Defining Service Attributes

Surrounding text describes Figure 4-8 .
  1. Enter the service attributes directly, or start with an existing service definition as follows:

    1. Click Select.

      A list of commonly used services is displayed.

      Select the Show All check box to show the entire list of predefined services.

    2. Select a service from the list. To view details about a service, highlight the service name and click Preview.


      To view the online help for the selected service, click the Help button on the Preview Information for Service <SERVICE_NAME> dialog.
    3. Click OK.

      The service attributes and actions are filled in.


      If you do not change the name of the service and this component is loaded last, the custom service will override the standard service and any other custom services with the same name.
    4. Edit the service attributes as necessary.

  2. Enter the actions as necessary.

    • Actions must appear in the Actions list in order of execution. Use the Up and Down buttons to move the selected action.

    • To add an action, click Add. Enter the action definition and click OK.

    • To edit an action, select the action and click Edit. Modify the action definition and click OK.

    • To remove an action, select the action and click Delete.

Figure 4-9 Defining an Action

Surrounding text describes Figure 4-9 .
  1. Click Finish.

    A dialog box asks if you want to launch the text editor to continue editing.

  2. Click Yes to open the resource file in the text editor. Click No to return to the Component Wizard.

    The service resource file now appears in the Custom Resource Definition list, and the service table appears in the Table Name list in the right pane.

Figure 4-10 Custom Service Resource Defined in the Component Wizard

Surrounding text describes Figure 4-10 .