Siebel Object Interfaces Reference > Interfaces Reference > Application Methods >

GetService Method


The GetService method returns a specified business service. If the business service is not already running, it is constructed.

Syntax

Application.GetService(serviceName)

Argument
Description

serviceName

The name of the service to start

Returns

A reference to the requested business service

Usage

This method finds the business service indicated by serviceName; it constructs the service if it is not already running. It first searches through the built-in services that are stored in the repository. If the business service is not found, GetService searches through services defined in the run-time Business Services table.

A business service is normally deleted from memory as soon as every reference to it, such as local or global variables, is cleared by setting it to another value. However, if the Cache flag on the business service is set, the service remains in memory as long as the Siebel application is running.

To invoke a business service using the Web Client Automation Server and Browser Script, the business service must first be registered in Siebel Tools as an application user property. This prevents Service Not Found errors.

To register a business service

  1. In Siebel Tools, select the Application object in the Object Explorer.
  2. Select the desired application, for example Siebel Universal Agent, in the Object List Editor.
  3. In the Object Explorer, expand the Application object, and then choose Application User Prop.
  4. In the Object List Editor, create new application user property records as needed:
    Name
    Value

    ClientBusinessService0

    XML Converter

    ClientBusinessService1

    My Business Service

    NOTE:  ClientBusinessServicen entries must be sequential, starting at 0 and incrementing by 1.

Used With

Browser Script, COM Data Control, COM Data Server, Java Data Bean, Mobile Web Client Automation Server, Server Script, Web Client Automation Server

Examples

The following examples instantiate a business service named Workflow Process Manager.

The following example is in Browser Script:

function Applet_PreInvokeMethod (name, inputPropSet)
{
   if (name == "MyCustomMethod")
   {
      var oBS;
      var inpPS;
      var outPS;
      inpPS = theApplication().NewPropertySet();
      outPS = theApplication().NewPropertySet();
      oBS = theApplication().GetService("Workflow Process Manager");
      outPS = oBS.InvokeMethod("RunProcess", inpPS);
      inpPS = null;
      outPS = null;
      return ("CancelOperation");
   }
   else
   {
      return ("ContinueOperation");
   }
}

The following example is in Siebel eScript:

function WebApplet_PreInvokeMethod (MethodName)
{
   if (MethodName == "MyCustomMethod")
   {
      var oBS;
      var inpPS;
      var outPS;
      inpPS = TheApplication().NewPropertySet();
      outPS = TheApplication().NewPropertySet();
      oBS = TheApplication().GetService("Workflow Process Manager");
      oBS.InvokeMethod("RunProcess", inpPS, outPS);
      inpPS = null;
      outPS = null;
      oBS = null;
      return (CancelOperation);
   }
   else
   {
      return (ContinueOperation);
   }
}

The following example is in Siebel VB:

Function WebApplet_PreInvokeMethod (MethodName As String) As Integer
If MethodName = "MyCustomMethod" Then
   Dim oBS As Service
   Dim inpPS As PropertySet
   Dim outPS As PropertySet
   Set inpPS = TheApplication.NewPropertySet
   Set outPS = TheApplication.NewPropertySet
   Set oBS = TheApplication.GetService("Workflow Process Manager")
   oBS.InvokeMethod "RunProcess", inpPS, outPS
   Set inpPS = Nothing
   Set outPS = Nothing
   Set oBS = Nothing
   WebApplet_PreInvokeMethod = CancelOperation
Else
   WebApplet_PreInvokeMethod = ContinueOperation
End If
End Function

Siebel Object Interfaces Reference Copyright © 2008, Oracle. All rights reserved.