Bookshelf Home | Contents | Index | PDF |
Siebel Portal Framework Guide > Web Engine HTTP TXN Business Service > Example of Using the Web Engine HTTP TXN Business ServiceTo 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
WebApplet_OutputchildPropertySets Functionfunction WebApplet_OutputChildPropertySets(oPropertySet, nLevel, fp) Clib.fputs('-------------------------------------\n',fp); Clib.fputs('CHILD PROPERTY SETS\n',fp); Clib.fputs('-------------------------------------\n',fp); if ( oPropertySet.GetChildCount() == 0 ) for ( nChild = 0; ( nChild <= oPropertySet.GetChildCount() - 1 ) ; nChild++ ) oChildPropSet = oPropertySet.GetChild(nChild); WebApplet_OutputPropertySet (oChildPropSet, nLevel+1, fp); WebApplet_OutputProperties Functionfunction WebApplet_OutputProperties(oPropertySet, nLevel , fp ) Clib.fputs('-------------------------------------\n',fp); Clib.fputs('PROPERTIES\n',fp); Clib.fputs('-------------------------------------\n',fp); if (oPropertySet.GetPropertyCount() == 0 ) strName = oPropertySet.GetFirstProperty(); Clib.fputs(strName + ' : ' + oPropertySet.GetProperty(strName) + '\n' ,fp); strName = oPropertySet.GetNextProperty(); WebApplet_OutputPropertySet Functionfunction WebApplet_OutputPropertySet(oPropertySet, nLevel, fp ) Clib.fputs('-------------------------------------\n',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('LEVEL : ' + nLevel + '\n',fp); Clib.fputs('-------------------------------------\n',fp); To add sample code for invoking methods of Web Engine HTTP TXN business service function WebApplet_InvokeMethod (MethodName) var fp = Clib.fopen('testfile.txt','a'); TheApplication().RaiseErrorText(" ERROR Opening File ") 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('Method: GetAllRequestCookies\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ( 'GetAllRequestCookies', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetAllRequestHeaders\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ('GetAllRequestHeaders', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetAllRequestParameters\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ('GetAllRequestParameters', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetAllResponseCookies\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ('GetAllResponseCookies', Inputs, Outputs) WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetAllResponseHeaders\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ('GetAllResponseHeaders', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetAllServerVariables\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ('GetAllServerVariables', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetRequestCookies\n',fp); Clib.fputs('=====================================\n',fp); 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('Method: GetRequestHeaders\n',fp); Clib.fputs('=====================================\n',fp); 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('Method: GetRequestInfo\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ('GetRequestInfo', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetRequestParameters\n',fp); Clib.fputs('=====================================\n',fp); 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('Method: GetResponseCookies\n',fp); Clib.fputs('=====================================\n',fp); Inputs.SetProperty ('My-Test-COOKIE', ''); Inputs.SetProperty ('_sn', ''); oBS.InvokeMethod ('GetResponseCookies', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetResponseHeaders\n',fp); Clib.fputs('=====================================\n',fp); Inputs.SetProperty ('Content-Language', ''); Inputs.SetProperty ('MyHeader', ''); oBS.InvokeMethod ('GetResponseHeaders', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetResponseInfo\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ('GetResponseInfo', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: GetServerVariables\n',fp); Clib.fputs('=====================================\n',fp); 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('Method: GetWebSessionInfo\n',fp); Clib.fputs('=====================================\n',fp); oBS.InvokeMethod ('GetWebSessionInfo', Inputs, Outputs); WebApplet_OutputPropertySet(Outputs, 0, fp); Clib.fputs('=====================================\n',fp); Clib.fputs('Method: SetResponseCookies\n',fp); Clib.fputs('=====================================\n',fp); 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'); 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'); 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('Method: SetResponseHeaders\n',fp); Clib.fputs('=====================================\n',fp); 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('Method: SetResponseInfo\n',fp); Clib.fputs('=====================================\n',fp); 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'); tmpCookie = TheApplication().NewPropertySet(); tmpCookie.SetType ('My_Test_Cookie2'); tmpCookie.SetValue ( 'Cookie Value for My_Test_Cookie2'); tmpCookie.SetProperty ( 'Max-Age', '23434343'); tmpCookie = TheApplication().NewPropertySet(); tmpCookie.SetType ('Another_Cookie2'); tmpCookie.SetValue ('Cookie Value for Another_Cookie2'); tmpCookie.SetProperty ('Max-Age', '23434343'); 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); 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 OutputThe following is an excerpt of the resulting text file ===================================== ===================================== ===================================== ===================================== ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ===================================== ===================================== ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- 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 ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- ===================================== Method: GetAllRequestParameters ===================================== ------------------------------------- ------------------------------------- ------------------------------------- ------------------------------------- SWEActiveView : Account List View SWEActiveApplet : Account List Applet SWEApplet : Account List Applet ------------------------------------- ------------------------------------- ------------------------------------- |
Siebel Portal Framework Guide |