Integration Platform Technologies: Siebel Enterprise Application Integration > Business Services >

Business Scenario for the Use of Business Services


Consider an example of a form on a corporate Web site. Many visitors during the day enter their personal data into the fields on the Web form. The field names represent arguments, whereas the personal data represent data. When the visitor clicks Submit on the form, the form's CGI script formats and sends the data by way of the HTTP transport protocol to the corporate Web server. The CGI script can be written in JavaScript, Perl, or another scripting language.

The CGI script might have extracted the field names and created XML elements from them to resemble the following XML tags:

First Name = <FirstName></FirstName>

Last Name = <LastName></LastName>

The CGI script might then have wrapped each data item inside the XML tags:

<FirstName>Hector</FirstName>

<LastName>Alacon</LastName>

To insert the preceding data into the Siebel Database as a Contact, your script calls a business service that formats the XML input into a property set structure that the Siebel application recognizes.

Code Sample Example for Creating a Property Set

The following is an example of the Siebel eScript code that you must write to create the property set:

x = TheApplication.InvokeMethod("WebForm", inputs, outputs);

var svc; // variable to contain the handle to the Service

var inputs; // variable to contain the XML input

var outputs; // variable to contain the output property set

svc = TheApplication().GetService("EAI XML Read from File");

   inputs = TheApplication().ReadEAIMsg("webform.xml");

   outputs = TheApplication().NewPropertySet();

svc.InvokeMethod("Read XML Hierarchy", inputs, outputs);

The following functions could be called from the preceding code. You attach the function to a business service in Siebel Tools:

NOTE:  You cannot pass a business object as an argument to a business service method.

Function Service_PreInvokeMethod(MethodName, inputs, outputs)

   {

   if (MethodName=="GetWebContact")

   {

      fname = inputs.GetProperty("<First Name>");

      lname = inputs.GetProperty("<Last Name>");

      outputs.SetProperty("First Name",fname);

      outputs.SetProperty("Last Name", lname);

   return(CancelOperation);

   }

return(ContinueOperation);

}

Function Service_PreCanInvokeMethod(MethodName, CanInvoke)

{

   if (MethodName="GetWebContact")

   {

      CanInvoke ="TRUE";

      return (CancelOperation);

   }

   else

   {

   return (ContinueOperation);

   }

}

Integration Platform Technologies: Siebel Enterprise Application Integration Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices.