We often have Siebel inbound web services, which take a lot of time to complete and finally time out.
We can create a web service which will accept the request for processing and then free the client instead of waiting for a response.
The basic thought is to convert the Synchronous call to an Asynchronous call.
Assume we have a workflow "Create Contact wf" which takes a long time and we want to call it Asynchronously.
We create a wrapper workflow in which we call a custom business service.
This custom business service will have the code to invoke "Server Requests" and submit a WfProcMgr job to run "Create Contact wf" asynchronously.
"Server Requests" business service can be used to submit a job to Workflow Process Manager Component (or any other component that accepts jobs) with one of the asynchronous modes: DirectDb / Async / Schedule
Find more details on how the Asynchronous server requests work here
Below is the sample code for the custom business service to take a workflow process property named "ContactIO" containing an IO named "EAI Contact" and pass it to an inner workflow that is called asynchronously and which has the same input process property "ContactIO" also containing an IO named "EAI Contact".
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
if (MethodName == "CallAsynchronousWf")
{
// instantiate the Business service "server requests"
var svc = TheApplication().GetService("Server Requests");
// create the variables for "server request" Business service input and output
var SRBSInputsPS= TheApplication().NewPropertySet();
var SRBSOutputsPS= TheApplication().NewPropertySet();
// set the input arguments for the "Server Requests" business service
SRBSInputsPS.SetProperty("Component", "WfProcMgr");
SRBSInputsPS.SetProperty("Method", "RunProcess");
SRBSInputsPS.SetProperty("Mode", "Async");
// set the inner workflow input and output
// the top level of inputs is empty
// child 0 is the IO instance
var wfInputsPS = Inputs.Copy();
wfInputsPS.SetProperty("ProcessName", "Create Contact wf");
/***********************
you have to set the type of the propertyset at the level where the integration object starts as the workflow process property name, so the workflow is able to read the integration object and you do not get the error "Input message is missing header properties.(SBL-EAI-04024)".
To make it simple, name the processproperty the same name as the IO.
********************/
wfInputsPS.GetChild(0).SetType("ContactIO");
var wfOutputsPS = TheApplication().NewPropertySet();
// workflow inputs is the IO instance and the process name and is a child of Server requests business service input.
SRBSInputsPS.AddChild(wfInputsPS);
// invoke the workflow
svc.InvokeMethod("SubmitRequest", SRBSInputsPS, SRBSOutputsPS);
}
return (CancelOperation);
}
We can create a web service which will accept the request for processing and then free the client instead of waiting for a response.
The basic thought is to convert the Synchronous call to an Asynchronous call.
Assume we have a workflow "Create Contact wf" which takes a long time and we want to call it Asynchronously.
We create a wrapper workflow in which we call a custom business service.
This custom business service will have the code to invoke "Server Requests" and submit a WfProcMgr job to run "Create Contact wf" asynchronously.
"Server Requests" business service can be used to submit a job to Workflow Process Manager Component (or any other component that accepts jobs) with one of the asynchronous modes: DirectDb / Async / Schedule
Find more details on how the Asynchronous server requests work here
Below is the sample code for the custom business service to take a workflow process property named "ContactIO" containing an IO named "EAI Contact" and pass it to an inner workflow that is called asynchronously and which has the same input process property "ContactIO" also containing an IO named "EAI Contact".
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
if (MethodName == "CallAsynchronousWf")
{
// instantiate the Business service "server requests"
var svc = TheApplication().GetService("Server Requests");
// create the variables for "server request" Business service input and output
var SRBSInputsPS= TheApplication().NewPropertySet();
var SRBSOutputsPS= TheApplication().NewPropertySet();
// set the input arguments for the "Server Requests" business service
SRBSInputsPS.SetProperty("Component", "WfProcMgr");
SRBSInputsPS.SetProperty("Method", "RunProcess");
SRBSInputsPS.SetProperty("Mode", "Async");
// set the inner workflow input and output
// the top level of inputs is empty
// child 0 is the IO instance
var wfInputsPS = Inputs.Copy();
wfInputsPS.SetProperty("ProcessName", "Create Contact wf");
/***********************
you have to set the type of the propertyset at the level where the integration object starts as the workflow process property name, so the workflow is able to read the integration object and you do not get the error "Input message is missing header properties.(SBL-EAI-04024)".
To make it simple, name the processproperty the same name as the IO.
********************/
wfInputsPS.GetChild(0).SetType("ContactIO");
var wfOutputsPS = TheApplication().NewPropertySet();
// workflow inputs is the IO instance and the process name and is a child of Server requests business service input.
SRBSInputsPS.AddChild(wfInputsPS);
// invoke the workflow
svc.InvokeMethod("SubmitRequest", SRBSInputsPS, SRBSOutputsPS);
}
return (CancelOperation);
}