Siebel Object Interfaces Reference > Interfaces Reference > Application Methods >

GetService Method


The GetService method returns a specified service. If the 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 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, are cleared by setting them 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 the application configuration file (such as uagent.cfg, sfs.cfg, and so on). This prevents Service Not Found errors. To register a business service in the application configuration file, navigate to the [SWE] section, and add entries like the following examples:

ClientBusinessService0 = "XML Converter"
ClientBusinessService1 = "Siebel Account"

ClientBusinessService 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