Home > Oracle, Siebel > How to capture business service inputs for use in Business Service Simulator

How to capture business service inputs for use in Business Service Simulator

Often errors reported in Siebel CRM Application, such unexpected processing results, application error or process crash can be initiated calling a certain custom or standard Business Service (BS).

Analysis of Siebel log / FDR / SARM traces may show that failure of Siebel Object Manager was caused by calling a method of a Business Service.

In this document we want to illustrate how the input arguments of a Business Service that was invoked during execution of the case could be captured in a file,

that can be picked up by the Business Service simulator.

Note: Not all Business Services of Siebel CRM Application could be invoked directly by BS-Simulator.

Usually good candidates for simulation are custom Business Services (server-side scripting), standard EAI Toolset Business Services (EAI Siebel Adapter/EAI UI Data Apdater,

an ASI/UDS, an Outbound WS Proxy, various XML Converters, the EAI Dispatcher,  the EAI Data Transformation Engine and so on) and the “Workflow Process Manager” BS.

Simulation of the “RunProcess” method of the  “Workflow Process Manager” Business Service allows to execute a workflow process process

within the BS-Simulator session, while same method invoked for the “Workflow Process Manager (Server Request)” BS

makes the process execution happen in separate task of the “Workflow Process Manager” server component.

 

Paths (can be combined) to capture the BS method input arguments in a file, that can be loaded in BS-Simulator.

(A) The .dmp File – input property set stored as XML document

Setting to “True” of the advanced component parameter: “Enable Business Service Argument Tracing” (short alias: “EnableServiceArgTracing“)
allows Siebel Object Manager component task to produce *.dmp files with input arguments for a certain standard business services.

Example of the  command of Server Manager Command line  utility (“srvrmgr“) that amends this parameter for a given component (example: “EAI Object Manager (ENU)“):
change param EnableServiceArgTracing=True for comp EAIObjMgr_enu

Once the parameter is set to “True” one also need to raise the logging level to 5 for tracing of a desired component event type,
to component task to trace arguments of a given Business Service into a *.dmp file.

Following two event types could be found useful:

(1) “EAI Dispatcher Argument Tracing” (short alias: “EAIDispatchSvcArgTrc“)

to let Inbound Web Service Framework component produce  “EAITransportDispatchService_input_args_*.dmp” file with input arguments

(original SOAP Message and HTTP Transport headers) received from Web Service Client (via Siebel Web Server Extension).

The .dmp file can be used as input of the “GenericDispatch” method of the “EAI Dispatch Service” Business Service to mimic the Inbound Web Service call dispatch.

Example of the  command of Server Manager Command line  utility (“srvrmgr“) that amends logging level of this event type to 5 for a given component

(example: “EAI Object Manager (ENU)“):

change evtloglvl EAIDispatchSvcArgTrc=5  for comp EAIObjMgr_enu

NOTE: To use this file as input in  the BS-Simulation one need to rename its extension to “.xml“.

NOTE-2: After(!), loading the file in BS-Simulator View one need to insert/correct the xml-prologue to <?xml version=”1.0″ encoding=”UTF-16″?>

to indicate the unicode text encoding, used by  Siebel UI

(2)  “EAI Siebel Adapter Argument Tracing” (short alias: “EAISiebAdptSvcArgTrc“)

to let methods of the “EAI Siebel Adapter” standard Business Service to produce produce “EAISiebelAdapter_input_args_*.dmp” files   with input arguments of the invoked method.

The .dmp file can be used as input of accordant menthod of the “EAI Siebel Adapter” Business Service.

Example of the  command of Server Manager Command line  utility (“srvrmgr“) that amends  logging level of this event type to 5 for a given component

(example: “EAI Object Manager (ENU)“):

change evtloglvl EAISiebAdptSvcArgTrc=5  for comp EAIObjMgr_enu

NOTE: To use this file as input in  the BS-Simulation one need to rename its extension to “.xml

 

(B) The .log File - Siebel Object Manager traces of various event types
Input arguments can be also captured right from the Siebel Application log, whenever one sees strings (often long) that starts 
 with the prefix: @0*  and  contains argumenz names and values separated by <NN>* ,  where <NN> is legth of a text value AFTER the * .

This string represents an internal serialization of a property set hierarchy, used by Siebel Object Manager to trace the property set content as string.

The serialization and de-serialization of a property set into / from a string is performed by standard Business Service "Workflow Utilities" 
 and its methods: "PropSetToText" and "TextToPropSet".
Traces of the the "Workflow Process Execution" (short alias: "PrcExec") and "Workflow Step Execution" (short: alias: "StpExec") component events
 shows input and output arguments (property set) for a workflow process start and execution of each its steps.

Example of the  command of Server Manager Command line  utility ("srvrmgr") that amends this parameter for a given component 
(example: "EAI Object Manager (ENU)"):
    change evtloglvl PrcExec=5  for comp EAIObjMgr_enu
 change evtloglvl StpExec=5  for comp EAIObjMgr_enu  

NOTE: Oversized property set can not be completely held in  the trace, in this cases, the approach will not work, 
 Incomplete trace can be recognized if last text elemnt the string does not follow the <NN>*<C(NN)> rule
 whre <NN> is number of characters: <C..C> after the *.

Below is  example of the Object Manager log file that  withinput argument traces for a Workflow Process  and a Business Service step:
ObjMgrBusServiceLog … InvokeMethod 4 … Begin: Business Service ‘Workflow Process Manager’ invoke method: ‘RunProcess’ …

EngInv EngInv 3 … Workflow engine requested to perform method ‘RunProcess’.

EngInv Arg 4Input: @0*0*1*1*0*3*0*11*ProcessName15*TST_T1_EAIQuery4*1*13*SiebelMessage0*9*MessageId9*8SIA-IDGZ11*MessageType18*Integration Object13*IntObjectName26*Internal Account Interface15*IntObjectFormat19*Siebel Hierarchical0*1*32*ListOfInternal Account Interface0*37*6*7*Account0*16*PO Approved Flag0*30*PO Auto Approval Currency Code3*USD17*Skip Credit Check1*N23*Assignment Country Code0*11*DUNS Number0*19*Parent Account Name0*25*Price List Integration Id0*10*Account Id10*8SIA-7EIGB14*Account Status6*Active20*Assignment Area Code0*17*Main Phone Number10*415897654318*Credit Status Date0*13*Currency Code3*USD20*Primary Organization20*Default Organization23*Parent Account Location0*15*Competitor Flag1*N14*Parent HQ DUNS0*5*Alias0*14*Integration Id0*29*Parent Account Integration Id0*12*Partner Flag1*N26*Credit Auto Approval Limit0*22*PO Auto Approval Limit0*4*Type8*Customer22*Domestic Ultimate DUNS0*19*Number of Employees0*9*Home Page0*21*PO Auto Approval Date0*9*Expertise0*23*VAT registration number0*15*Main Fax Number0*8*Location12*HQ-Corporate20*Global Ultimate DUNS0*4*Name15*A.K Parker Inc.17*Parent Account Id0*10*Price List0*13*Price List Id0*0*1*22*ListOfBusiness Address0*11*0*16*Business Address0*12*IsPrimaryMVG1*Y16*Street Address 20*6*County0*4*City8*Danville14*Street Address17*100 Danville Blvd5*State2*CA7*Country3*USA10*Address Id8*1-1FIG+C22*Address Integration Id0*8*Province0*11*Postal Code5*945860*1*23*ListOfRelated Sales Rep0*6*0*17*Related Sales Rep0*8*Position42*FIN 00 30 – Financial Advisor Credit Cards8*Division20*Default Organization12*IsPrimaryMVG1*Y5*Login7*PCONNOR11*Position Id10*8SIA-70NAN23*Position Integration Id0*0*0*21*ListOfRelated Contact0*0*1*26*ListOfRelated Organization0*4*0*20*Related Organization0*12*IsPrimaryMVG1*Y15*Organization Id6*0-R9NH27*Organization Integration Id0*12*Organization20*Default Organization0*0*20*ListOfCredit Profile0*0*0*22*ListOfRelated Industry0*

PrcExec PrcExec 3 … Executing process definition ‘MyProcess’.

PrcExec Create 4 … Instantiating process definition ‘MyProcess‘.

PrcExec PropSet 4    …    @0*0*4*1*13*SiebelMessage0*9*MessageId…22*ListOfRelated Industry0*

StpExec Create  4    …    Instantiating step definition ‘Start‘.

StpExec Create 4 … Instantiating step definition ‘MyBSstep‘.

StpExec Task 4 … Invoking method ‘MyMethhod‘ on business service ‘MyBS‘.

StpExec TaskArg 4 … Input: @0*

 

To turn the string with serialized representation of a property set into .xml  file, so that can be used as input arguments with BS-Simulator,

following custom business service: “AUX_T2PS” (attached as the “AUX_T2PS.xml” file to this document) can be used,

The BS to combines calls of following standard BS::Methods

  • EAI File Transport::Receive” – to read the serialized property set string from a file (a UTF-8 text copied from a .log file and begins with @0*)
  • Workflow Utilities::TextToPropSet” – to de-serialize the string from a file into a property set hierarchy
  • EAI XML Write to File::WritePropSet” – to save property set into an .xml file, that can be loaded in BS-Simulator (input arguments applet).

The Business Service has single method (“Execute“) and following input arguments:

  • FileName” – to specify location / name of the input text wile with a serialized property set string that begins with @0*  (will be read)
  • FileName2″ – to specify location / name of the  output .xml file with the decoded property set (will be produced)
  • other input parameters are optional and if present, will be passed to the “Receive” method of the “EAI File Transport” BS

This Business Service can be defined as run-time BS (defined in Siebel Client and requires no .SRF compilation)

The Business Service code (for copy+paste into BS server code edit):

Service_PreInvokeMethod:
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
try
{
//
// Read text file with the property set (serilalized as string)
//
var psX = Inputs.Copy();
var                   sCP = “CharSetConversion”;
if(  psX.GetProperty( sCP ) == “” )
psX.SetProperty( sCP,”UTF-8″ );
TheApplication().GetService(“EAI File Transport”).InvokeMethod(“Receive”, psX, Outputs );

//
// De-serialize property set from string into a property set object
//
psX = Outputs.Copy();
TheApplication().GetService(“Workflow Utilities”).InvokeMethod(“TextToPropSet”, psX, Outputs );

//
// Write xml file with the property set (serialized as XML document)
//
psX = Outputs.Copy();
psX.SetType(“PropertySet”);
psX.SetProperty(“FileName”, Inputs.GetProperty( “FileName2”) );
TheApplication().GetService(“EAI XML Write to File”).InvokeMethod(“WritePropSet”, psX, Outputs );
}
finally
{
//
// Done.
//
psX =  null;
};
return (CancelOperation);
}

WARNING: The provided code example is given for illustration purpose only.

(C) the Service_PreInvokeMethod event handler (server side code)
Finally one can temporary put a server side code into the "Service_PreInvokeMethod" event handler of a Business Service, to capture input arguments of the invoked method.

Following provides an example of a Siebel eScript code, one could put in the business service in order to capture input arguments in an *.xml file. In this example, the file will be produced 
in the "../log" folder of the current Siebel Application directory (which is usually: "bin" folder of the software installation root). 
The name of the file will contain the Business Service name (with stripped blank characters), the method name, the sequential number - incremented at each call in
 this session and the random number, to provide unique (across all sessions) part to the file name.
(declarations):
var nCnt = 0;                                                        //dump files counter
var dmp_filePfx = “../log/” + this.Name().replace(/ /g,””) +  “_”;   //dump file prefix (folder + BS name)


Service_PreInvokeMethod:
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
try  //dump input arguments of any method
{
var psIn = Inputs.Copy();
psIn.SetProperty(“FileName“, dmp_filePfx + MethodName + “_” + ToString(++nCnt) + “_$$_input.xml” ); //provide the dump file name
psIn.SetType(“PropertySet“);
with(TheApplication() ) GetService(“EAI XML Write to File“).InvokeMethod(“WritePropSet”, psIn, NewPropertySet() ); //create the dump file
}
finally {   psIn = null; }; //cleanup
return(ContinueOperation);
}

NOTE: This code overwrites value of the “FileName” input argument if any would be provided the method invocation. To keep the original value of this input argument, one need to add extra code to obtain its value

and store into alternative parameter (such as :”Original_FileName”) and then, in the BS-Simulator View, correct the input argument name back to: “FileName”.

NOTE-2: An invocation of standard business service method may not necessary invoke the server side code of the event handler. Some specialized and internal business services may not presume use

of the scripting engine of Siebel Application. However in may “regular” cases the scripting engine is used to the custom code that will dump the input arguments, so that they could be used in the BS-Simulator.

WARNING: The provided code example is given for illustration purpose only.

Before this kind of solution could be placed in a production environment, it has to be verified/tested against potential data damage and loss.

 

Auxiliary Workflow Process to invoke a Business Service with complex arguments from Business Service Simulator View

In some cases, such as Siebel UI size constrains for input or output argument fields), need to use non UTF-16 encoding,
either input arguments cannot be loaded from an .xml file  or7and output arguments could not be displayed in the BS-Simulator View.

In such situation it is practical to define a 3 steps auxiliary workflow process or  a custom business service to that actual invokes being tested Business Service
so that initiation of simulation in the BS-Simulator View becomes just a start of this this auxiliary process (using the “RunProcess” method of the “Workflow Process Manager” BS) or business service.

The auxiliary process / business should:
– read the input arguments from an .xml file
– invoked the being tested method of the Business Service
– write the output arguments in an .xml file

The Business Service has single method (“Execute“) and following input arguments:

  • FileName” – to specify location / name of the input .xml with  with content of input argunents (will be read)
  • FileName2″ – to specify location / name of the  output .xml file with content of output argunents (will be produced)
  • BS” – to specify name of being tested Business Service
  • Method” – to specify name of the Business Service method
  • other input parameters are optional and if present, will be passed to the “Receive” method of the “EAI File Transport” BS

This Business Service can be defined as run-time BS (defined in Siebel Client and requires no .SRF compilation)

The Business Service code (for copy+paste into BS server code edit):

Service_PreInvokeMethod:
function Service_PreInvokeMethod (MethodName, Inputs, Outputs)
{
try
{
with( TheApplication() )
{
//
//  Load Input arguments
//
var psIn   = NewPropertySet();
GetService(“EAI XML Read from File“).InvokeMethod(“ReadPropSet”, Inputs, psIn ); //”FileName” in Inputs will be used to load ps from file
//
//  Invoke the Business Service
//
var sBS      = Inputs.GetProperty(“BS“);
var sMethod = Inputs.GetProperty(“Method“);
var psOut    = NewPropertySet();
GetService( sBS ).InvokeMethod( sMethod , psIn, psOut );
//
//  Save Output arguments
//
psOut.SetProperty(“FileName“, Inputs.GetProperty(“FileName2“) );
GetService(“EAI XML Write to File“).InvokeMethod(“WritePropSet”, psOut, Outputs ); //Outputs: will show result of saving ps in the file
}; // end-with: TheApplication
}
finally {   psIn = null; psOut = null; }; //cleanup
return(ContinueOperation);
}
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: