Siebel Advisor API Reference > Siebel Advisor API Examples >

Example of Using the CDA Service Broker


This example shows how to use the CDA Service Broker method in the ISSCDA RT UI Service. The example includes the following three parts:

  • Client JavaScript
  • Client HTML
  • Business service script
Client JavaScript

This is an example of the client JavaScript.

<script>

//Include the propset.js file in the SWE scripts directory if you are using the CDAReturnHandler parameter option

// Example function shows how to use the CDAServiceBroker

function PostThis(method, varName, varVal){

   var argObj = new Array();

// Defines the business service that you want CDAServiceBroker to call

   argObj["CDAExternalServiceName"] = "CDA Broker Test";

   if(typeof method != 'undefined')

      argObj["CDAExternalMethodName"] = method;

   if(typeof varName != 'undefined' && typeof varVal != 'undefined')

      argObj[varName]=varVal;

   argObj["target"] = OL.FrameToString(OL)+"."+"dataFrame";

OL.SendSelectionInformationToServer("ISSCDA RT UI Service", "CDAServiceBroker", "prodStr", true, argObj);

}

// Example event handler to demonstrate how the CDAServiceBroker can be used

function alertEvent(ps)

{

   if (ps != null)

   {

for (bFirst = true; (arg = ps.EnumProperties (bFirst)) != null; bFirst = false)

      {

         value = ps.GetProperty (arg);

         alert(arg + "=" + value);

      }

   }

   else

   {

   alert("Empty PropertySet in function alertEvent");

   }

} </script>

Client HTML

The following HTML code is an example of the body (<BODY>) section of the output layout file.

<!—Client request requires no confirmation from the BC -->

<p><a href="javascript:''" onClick="PostThis('NoInput'); return false;">No return specified</A>

<!—Client request that requires no confirmation from the business service, but the BC switches view ->

<p><a href="javascript:''" onClick="PostThis('NoInputGotoView'); return false;">No return specified but the server will switch view</A>

<!—Client request that requires a confirmation from the business service that calls an event handler ->

<p><a href="javascript:''" onClick="PostThis('OutputEventHandler','CDAReturnHandler',OL.FrameToString(window)+'.alertEvent');return false;">Using eventHandler for the propertyset</A>

<!—Client request that requires a confirmation from the business service that sets the default property set values ->

<p><a href="javascript:''" onClick="PostThis('OuputtoDefaultPropertySet'); return false;">Default Output</A>

<!—Client request that requires a confirmation from the business service that sets a specific property set values->

<p><a href="javascript:''"onClick="PostThis('DefinedOutput','CDAReturnValue', 'myoutput'); return false;">defined output with myoutput</A>

<p>

Business Service Script Called by CDAServiceBroker

This is an example business service script (CDA Broker Test) called by CDAServiceBroker. The example shows how to set up the response messages for the client.

function Service_PreInvokeMethod(methodName, inputArg, outputArg)

{

   var outstr = "<html><head></head><body>";

   var alertstr="from method: "+methodName;

   outstr+="<script>alert(\'"+alertstr+"\');</script>";

   outstr+="</body></html>";

   if(methodName == "NoInput") {

      return (CancelOperation);

   }

   else if(methodName == "NoInputGotoView") {

      TheApplication().GotoView("Quote List View");

   }

   else if(methodName == "OuputtoDefaultPropertySet") {

         outputArg.SetProperty("CDAReturnValue", outstr);

      return (CancelOperation);

   }

   else if(methodName == "DefinedOutput") {

         outputArg.SetProperty("myoutput", outstr);

      return (CancelOperation);

   }

   else if(methodName == "OutputEventHandler") {

         outputArg.SetProperty("method", methodName);

         outputArg.SetProperty("method2", methodName);

      return (CancelOperation);

   }

   else {

      return (ContinueOperation);

   }

}

Siebel Advisor API Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.