Siebel Portal Framework Guide > Web Engine HTTP TXN Business Service >

Example of Using the Web Engine HTTP TXN Business Service


To invoke each method of the Web Engine HTTP TXN business service and write the results to a text file use the following two procedures:

To add sample code for displaying results of Web Engine HTTP TXN business service

  1. In Oracle's Siebel Tools navigate to the desired Applet object, in the Object Explorer.
  2. Lock the project if required.
  3. Right click and select the Edit Server Script option.
  4. Add the following three functions, individually to the declarations section:
    • WebApplet_OutputchildPropertySets
    • WebApplet_OutputProperties
    • WebApplet_OutputPropertySet
WebApplet_OutputchildPropertySets Function

function WebApplet_OutputChildPropertySets(oPropertySet, nLevel, fp)

{

var oChildPropSet;

var nChild = 0;

Clib.fputs('-------------------------------------\n',fp);

Clib.fputs('CHILD PROPERTY SETS\n',fp);

Clib.fputs('-------------------------------------\n',fp);

if ( oPropertySet.GetChildCount() == 0 )

{

Clib.fputs('(NONE)\n',fp);

}

else

{

for ( nChild = 0; ( nChild <= oPropertySet.GetChildCount() - 1 ) ; nChild++ )

{

oChildPropSet = oPropertySet.GetChild(nChild);

WebApplet_OutputPropertySet (oChildPropSet, nLevel+1, fp);

}

}

}

WebApplet_OutputProperties Function

function WebApplet_OutputProperties(oPropertySet, nLevel , fp )

{

var strName;

var strValue;

Clib.fputs('-------------------------------------\n',fp);

Clib.fputs('PROPERTIES\n',fp);

Clib.fputs('-------------------------------------\n',fp);

if (oPropertySet.GetPropertyCount() == 0 )

{

Clib.fputs('(NONE)\n',fp);

}

else

{

strName = oPropertySet.GetFirstProperty();

while ( strName != '')

{

Clib.fputs(strName + ' : ' + oPropertySet.GetProperty(strName) + '\n' ,fp);

strName = oPropertySet.GetNextProperty();

}

}

}

WebApplet_OutputPropertySet Function

function WebApplet_OutputPropertySet(oPropertySet, nLevel, fp )

{

Clib.fputs('\n',fp);

Clib.fputs('-------------------------------------\n',fp);

Clib.fputs('START' + ' ',fp);

Clib.fputs('LEVEL : ' + nLevel + '\n', fp);

Clib.fputs('-------------------------------------\n',fp);

Clib.fputs('TYPE : ' + oPropertySet.GetType() + '\n',fp);

Clib.fputs('VALUE : ' + oPropertySet.GetValue() + '\n',fp);

WebApplet_OutputProperties(oPropertySet, nLevel, fp);

WebApplet_OutputChildPropertySets(oPropertySet, nLevel, fp);

Clib.fputs('-------------------------------------\n',fp);

Clib.fputs('END' + ' ',fp);

Clib.fputs('LEVEL : ' + nLevel + '\n',fp);

Clib.fputs('-------------------------------------\n',fp);

}

To add sample code for invoking methods of Web Engine HTTP TXN business service

  1. Add the following code to the WebApplet_InvokeMethod event.

function WebApplet_InvokeMethod (MethodName)

{

var fp = Clib.fopen('testfile.txt','a');

if ( fp == null )

{

TheApplication().RaiseErrorText(" ERROR Opening File ")

}

else

{

var oBS = TheApplication().GetService('Web Engine HTTP TXN');

var Inputs = TheApplication().NewPropertySet();

var Outputs = TheApplication().NewPropertySet();

var Headers = TheApplication().NewPropertySet();

var Cookies = TheApplication().NewPropertySet();

var tmpCookie = TheApplication().NewPropertySet();

Clib.fputs('=====================================\n',fp);

Clib.fputs('WebApplet InvokeMethod event:\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetAllRequestCookies\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ( 'GetAllRequestCookies', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetAllRequestHeaders\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ('GetAllRequestHeaders', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetAllRequestParameters\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ('GetAllRequestParameters', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetAllResponseCookies\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ('GetAllResponseCookies', Inputs, Outputs)

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetAllResponseHeaders\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ('GetAllResponseHeaders', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetAllServerVariables\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ('GetAllServerVariables', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetRequestCookies\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

Inputs.SetProperty ('MY-COOKIE', '');

Inputs.SetProperty ('TestCookie', '');

Inputs.SetProperty ('Test1Cookie', '');

oBS.InvokeMethod ('GetRequestCookies', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetRequestHeaders\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

Inputs.SetProperty ('MyHEADER', '');

Inputs.SetProperty ('MY_TEST', '');

Inputs.SetProperty ('CONTENT-TYPE', '');

Inputs.SetProperty ('CONTENT-LENGTH', '');

oBS.InvokeMethod ('GetRequestHeaders', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetRequestInfo\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ('GetRequestInfo', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetRequestParameters\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

Inputs.SetProperty ('TestQstr', '');

Inputs.SetProperty ('SWEActiveView', '');

Inputs.SetProperty ('SWECmd', '');

Inputs.SetProperty ('SWEMethod', '');

Inputs.SetProperty ('TestParam', '');

oBS.InvokeMethod ('GetRequestParameters', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetResponseCookies\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

Inputs.SetProperty ('My-Test-COOKIE', '');

Inputs.SetProperty ('_sn', '');

oBS.InvokeMethod ('GetResponseCookies', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetResponseHeaders\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

Inputs.SetProperty ('Content-Language', '');

Inputs.SetProperty ('MyHeader', '');

oBS.InvokeMethod ('GetResponseHeaders', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetResponseInfo\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ('GetResponseInfo', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetServerVariables\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

Inputs.SetProperty ('AUTH-USER-ID', '');

Inputs.SetProperty ('SERVER-NAME', '');

oBS.InvokeMethod ('GetServerVariables', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: GetWebSessionInfo\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

oBS.InvokeMethod ('GetWebSessionInfo', Inputs, Outputs);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: SetResponseCookies\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

tmpCookie = null;

tmpCookie = TheApplication().NewPropertySet();

tmpCookie.SetType ('My_Test_Cookie');

tmpCookie.SetValue ('Cookie Value for My_Test_Cookie');

tmpCookie.SetProperty ('Max-Age', '23434343');

tmpCookie.SetProperty ('Domain', '.siebel.com');

tmpCookie.SetProperty ( 'Path', 'eapps/test/cookie/path');

Inputs.AddChild (tmpCookie);

tmpCookie = null;

tmpCookie = TheApplication().NewPropertySet();

tmpCookie.SetType ('Another_Cookie');

tmpCookie.SetValue ('Cookie Value for Another_Cookie');

tmpCookie.SetProperty ('Max-Age', '23434343');

tmpCookie.SetProperty ('Domain', 'esales.siebel.com');

tmpCookie.SetProperty ('Path', 'esales/cookie/path');

Inputs.AddChild (tmpCookie);

oBS.InvokeMethod ('SetResponseCookies', Inputs, Outputs);

Clib.fputs('------------------------------------\n',fp);

Clib.fputs('Input Cookies\n',fp);

Clib.fputs('------------------------------------\n',fp);

WebApplet_OutputPropertySet(Inputs, 0, fp);

oBS.InvokeMethod ('GetAllResponseCookies', Inputs, Outputs);

Clib.fputs('------------------------------------\n',fp);

Clib.fputs('Output Cookies\n',fp);

Clib.fputs('------------------------------------\n',fp);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: SetResponseHeaders\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

Inputs.SetProperty ('MyHeader', 'THIS is MyHeader');

oBS.InvokeMethod ('SetResponseHeaders', Inputs, Outputs);

Clib.fputs('------------------------------------\n',fp);

Clib.fputs('Input Headers\n',fp);

Clib.fputs('------------------------------------\n',fp);

WebApplet_OutputPropertySet(Inputs, 0, fp)

oBS.InvokeMethod ('GetAllResponseHeaders', Inputs, Outputs);

Clib.fputs('------------------------------------\n',fp);

Clib.fputs('Output Headers\n',fp);

Clib.fputs('------------------------------------\n',fp);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fputs('\n',fp);

Clib.fputs('=====================================\n',fp);

Clib.fputs('Method: SetResponseInfo\n',fp);

Clib.fputs('=====================================\n',fp);

Inputs.Reset();

Outputs.Reset();

Headers.Reset();

Cookies.Reset();

Headers.SetType ('HEADERS');

Headers.SetProperty ('ABC_RESPONSE_HEADER1', 'RESPONSE_HEADER1 Value');

Headers.SetProperty ('ABC_RESPONSE_HEADER2', 'RESPONSE_HEADER2 Value');

Headers.SetProperty ('ABC_RESPONSE_HEADER3', 'RESPONSE_HEADER3 Value');

Headers.SetProperty ('ABC_RESPONSE_HEADER4', 'RESPONSE_HEADER4 Value');

Inputs.AddChild( Headers);

Cookies.SetType('COOKIES');

tmpCookie = null;

tmpCookie = TheApplication().NewPropertySet();

tmpCookie.SetType ('My_Test_Cookie2');

tmpCookie.SetValue ( 'Cookie Value for My_Test_Cookie2');

tmpCookie.SetProperty ( 'Max-Age', '23434343');

Cookies.AddChild (tmpCookie);

tmpCookie = null;

tmpCookie = TheApplication().NewPropertySet();

tmpCookie.SetType ('Another_Cookie2');

tmpCookie.SetValue ('Cookie Value for Another_Cookie2');

tmpCookie.SetProperty ('Max-Age', '23434343');

Cookies.AddChild (tmpCookie);

Inputs.AddChild (Cookies);

oBS.InvokeMethod ('SetResponseInfo', Inputs, Outputs);

Clib.fputs('------------------------------------\n',fp);

Clib.fputs('Input Info\n',fp);

Clib.fputs('------------------------------------\n',fp);

WebApplet_OutputPropertySet(Inputs, 0, fp);

oBS.InvokeMethod ('GetResponseInfo', Inputs, Outputs);

Clib.fputs('------------------------------------\n',fp);

Clib.fputs('Output Info\n',fp);

Clib.fputs('------------------------------------\n',fp);

WebApplet_OutputPropertySet(Outputs, 0, fp);

Clib.fclose(fp);

}

}

  • Compile the project.
  • Launch the Siebel application.
  • Navigate to the applet where the server script has been placed.
  • Perform an action on the applet that invokes a SWE method (for example, change the record or create a new record).

    The code will generate a text file in the \bin folder where the Siebel application is installed containing results of each method of the Web Engine HTTP TXN business service.

    Sample Output

    The following is an excerpt of the resulting text file

    =====================================

    WebApplet InvokeMethod event:

    =====================================

    =====================================

    Method: GetAllRequestCookies

    =====================================

    -------------------------------------

    START LEVEL : 0

    -------------------------------------

    TYPE : COOKIES

    VALUE :

    -------------------------------------

    PROPERTIES

    -------------------------------------

    (NONE)

    -------------------------------------

    CHILD PROPERTY SETS

    -------------------------------------

    -------------------------------------

    START LEVEL : 1

    -------------------------------------

    TYPE : SWEUAID

    VALUE : 1

    -------------------------------------

    PROPERTIES

    -------------------------------------

    Max-Age : -1

    Domain :

    Path :

    -------------------------------------

    CHILD PROPERTY SETS

    -------------------------------------

    (NONE)

    -------------------------------------

    END LEVEL : 1

    -------------------------------------

    -------------------------------------

    END LEVEL : 0

    -------------------------------------

    =====================================

    Method: GetAllRequestHeaders

    =====================================

    -------------------------------------

    START LEVEL : 0

    -------------------------------------

    TYPE : HEADERS

    VALUE :

    -------------------------------------

    PROPERTIES

    -------------------------------------

    HOST : <host computer name>

    CACHE-CONTROL : no-cache

    CONNECTION : Keep-Alive

    COOKIE : SWEUAID=1

    USER-AGENT : Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; SV1; .NET CLR 1.1.4322)

    CONTENT-TYPE : application/x-www-form-urlencoded

    ACCEPT-ENCODING : deflate

    CONTENT-LENGTH : 348

    -------------------------------------

    CHILD PROPERTY SETS

    -------------------------------------

    (NONE)

    -------------------------------------

    END LEVEL : 0

    -------------------------------------

    =====================================

    Method: GetAllRequestParameters

    =====================================

    -------------------------------------

    START LEVEL : 0

    -------------------------------------

    TYPE : PARAMETERS

    VALUE :

    -------------------------------------

    PROPERTIES

    -------------------------------------

    SWEActiveView : Account List View

    SWERowIds :

    SWEP :

    SWESP : false

    SWECmd : InvokeMethod

    SWEMethod : PositionOnRow

    SWER : 1

    SWEControlClicked : 0

    SWEIgnoreCtrlShift : 0

    SWEVI :

    SWEActiveApplet : Account List Applet

    SWERPC : 1

    SWEReqRowId : 1

    SWEView : Account List View

    SWEC : 3

    SWERowId : 1-6

    SWEShiftClicked : 0

    SWETS : 1118939959734

    SWEApplet : Account List Applet

    -------------------------------------

    CHILD PROPERTY SETS

    -------------------------------------

    (NONE)

    -------------------------------------

    END LEVEL : 0

    -------------------------------------

  • Siebel Portal Framework Guide Copyright © 2006, Oracle. All rights reserved.