Siebel Open UI – asynchronous call in PM-PR

Prior to Open UI you could only call workflows in asynchronous mode. Well technically it was possible to call a business service asynchronously by wrapping it in a workflow. With Open UI Oracle has provided us with a way to call Business Service, Business Component Methods, Applet Methods and of-course workflows asynchronously. The icing on the cake is ability to associate a call back method that will be executed once the request is complete.

Excited????  Now imagine that you have implement following requirement.

You have to implement a search functionality with following features:

  • User should be able to click search image to initiate search.
  • While the search is happening page should get a nice Web 2.0 style “Please Wait” message.
  • UI should be blocked so that user cannot do anything (except for closing the browser window) funny while waiting for search to complete.
  • Once the search is complete everything should return to normal and UI should be unblocked.

There are three parts to this requirement:

  1. To be able to search by clicking on an image
  2. Block the UI Show a “Please Wait” message.
  3. Perform Search, Unblock UI and remove the message.

In this post I will only be discuss third part that involves invoking search functionality asynchronously. So, what are we waiting for let’s get started!!

Siebel has introduced another parameter in BS and BC method calls, named AI (Additional Input) that can run an AJAX calls. You define AI as JavaScript Object and it have following arguments

  • async : True or False. If True then method the call will be made asynchronously
  • cb: Define a callback function that should be called once the method is complete
  • scope: the value should be “this” (without quotes)
  • errcb: Have a error callback function if AJAX call fails
  • opdecode: Decode or not decode the AJAX call
  • mask: Mask the screen or not
  • selfbusy: Display busy cursor or not

Now back to the 3rd part of the requirement. On click of image a method define applet to perform search should be called in async mode using AI parameter.

Below is how would define the AI object

var configObj = {}; //define an empty object

configObj.async = true; //this is key argument. if set to false then method will be called in usual way.
configObj.scope = this; //always set as "this"
config.cb = function(){ //method to execute as callback function.
//write any code here that you would like to execute
//after the call is complete
}

To call method in Physical Renderer following code is used to invoke the method

var inPS= SiebelApp.S_App.NewPropertySet();
this.GetPM().ExecuteMethod("InvokeMethod","ExecuteSearch", inPS, configObj);

To call method in Presentation Model following code will be used to invoke the method:

var inPS= SiebelApp.S_App.NewPropertySet();
this.ExecuteMethod("InvokeMethod","ExecuteSearch", inPS, configObj);

In next post we will discuss blocking the UI part and finally the how the whole solution works.
Stay tuned!!!

3 Responses to Siebel Open UI – asynchronous call in PM-PR

  1. Hi Neel,

    Thanks for this nice article.
    I did a little POC to check the working of Async call but I found out that although async calling frees up the ui and user can perform an action(e.g call another workflow or another ui event) but it waits for the first action to complete.

    Here is the sample code:
    var tt = new Date();
    var e = SiebelApp.S_App.GetService(“Workflow Process Manager”);
    var t = SiebelApp.S_App.NewPropertySet();
    var n = SiebelApp.S_App.NewPropertySet();
    t.SetProperty(“ProcessName”, “XXXXXXXXXXXXXXXXXXXXXXXXXXXX”);
    t.SetProperty(“s_CustNum”, “XXXXXX”);
    t.SetProperty(“s_CISKey”, “XXXXXXX”);
    t.SetProperty(“CISKey”, “XXXXXXX”);
    t.SetProperty(“s_Location”, “XXXXXXXX”);
    NextRecordNumber = “0”;
    t.SetProperty(“s_NextRecNum”, NextRecordNumber);
    var o = {};
    o.async = true;
    o.scope = this;
    o.selfbusy=true;
    o.cb = function () {
    console.log(“>>>>>>>>>Callback complete for first call<<<<<<<");
    var t1= new Date();
    console.log("Time for first call ="+(t1-tt));
    n = arguments[2];
    WBCOutputPropertyVal = n.GetChildByType("ResultSet").GetProperty("FinalOutput");
    if (WBCOutputPropertyVal == "") {
    WBCOutputPropertyVal = n.GetChildByType("ResultSet").GetProperty("s_res258XML")
    }
    if ($(WBCOutputPropertyVal).find("WBCNextRecNum").text()) {
    WBCIsNextPage = "true";
    NextRecordNumber = $(WBCOutputPropertyVal).find("WBCNextRecNum").last().text();
    $("#WBCNextProducts").attr("disabled", false)
    } else {
    WBCIsNextPage = "false";

    }

    };
    t.SetProperty("s_Customer", "XXXX")
    if (e) {
    e.InvokeMethod("RunProcess", t, o)

    }

    If I executed this workflow once the response time was around 600 ms but if the same call was made thrice the response time of each call adds up.

    first call response in – 600ms
    second call response in – 1100 ms
    third call response in – 1800 ms

    Ideally the async call response should have been around 600 – 800 ms.

  2. Hi Neel/Agnivesh,

    Can we use the output of BS if we call it in asynch mode from Open UI. I am trying to achieve the same, but not able to find a way. Requirement is to display charts, data for the same I am getting from a BS. It is working fine if I call BS in synch mode. But sometimes it takes time, so I do not want to block the UI. UI should get rendered and chart will be displayed when BS returns result.

    Please advise.

  3. The calls are executed on server sequentially. Siebel only allocate one thread per user session, so technically it is not possible to run parallel tasks in same session. If really async tasks need to be run then other component is needed, but that will go outside user session and difficult to track back.

Leave a Reply

Contribute