The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Siebel::Integration::Com - Abstraction of Siebel Application

SYNOPSIS

        use Siebel::Integration::Com;

        my %inputs = (
                user => 'SADMIN',
                pass => 'PASSWORD',
                ObjMgr => 'ObjMgr',#thin client only
                ent => 'MYENT',#thin client only
                host => 'MYHOSTNAME',#thin client only
                cfg => 'C:/Siebel/publicsector.cfg',#thick client only
                DataSource => 'ServerDataSrc',#thick client only
        );
        
        #Thin (Server)
        my $SiebelThin = Siebel::Integration::Com->new(
                        ConnectionType=>'Thin', 
                        UserName=>$inputs{user}, 
                        PassWord=>$inputs{pass}, 
                        Host=>$inputs{host}, 
                        Ent=>$inputs{ent}, 
                        ObjMgr=>$inputs{ObjMgr}
                );

        #Thick (Dedicated)
        my $SiebelThick = Siebel::Integration::Com->new(
                        ConnectionType=>'Thick', 
                        UserName=>$inputs{user}, 
                        PassWord=>$inputs{pass}, 
                        CFG=>$inputs{cfg}, 
                        DataSource=>$inputs{DataSource}
                );
        
        #get and set some basic values
        print "Prof Attr Set\n" if $SiebelApp->SetProfileAttr("Test Attr 1", "TestVal 1");
        print 'Get Prof Attr: ' . $SiebelApp->GetProfileAttr("Test Attr 1") . "\n";
        print 'CurrencyCode: ' . $SiebelApp->CurrencyCode() . "\n";
        print 'LoginId: ' . $SiebelApp->LoginId() . "\n";
        print 'LoginName: ' . $SiebelApp->LoginName() . "\n";
        print 'PositionId: ' . $SiebelApp->PositionId() . "\n";
        print 'PositionName: ' . $SiebelApp->PositionName() . "\n";
        print "Shared Global Set\n" if $SiebelApp->SetSharedGlobal('COMGlobal','Set');
        print 'GetSharedGlobal - COMGlobal: ' . $SiebelApp->GetSharedGlobal('COMGlobal') . "\n";        

        #Query for Current user. See Siebel::Integration::Com::BusObj and Siebel::Integration::Com::BusComp for full details
        my $BO = $SiebelApp->GetBusObject('Employee');
        my $BC = $BO->GetBusComp('Employee');

        $BC->ClearToQuery();
        $BC->SetViewMode('AllView');
        $BC->ActivateFields('First Name','Last Name','Login Name');
        $BC->SetSearchSpec('Id', $SiebelApp->LoginId());
        $BC->ExecuteQuery('ForwardOnly');
        if($BC->FirstRecord()){
                print "FName: " . $BC->GetFieldValue('First Name') . "\t";
                print "LName: " . $BC->GetFieldValue('Last Name') . "\t";
                print "Login: " . $BC->GetFieldValue('Login Name') . "\n";
        }else{
                die print "Something is wrong!";
        }

        #Business Service Call with Property Set. See Siebel::Integration::Com::BusSrv and Siebel::Integration::Com::PropSet for full details
        my $BS = $SiebelApp->GetService('Workflow Utilities');
        my $PS = $SiebelApp->NewPropertySet();
        my $PSChild = $SiebelApp->NewPropertySet();
        my $Outputs = $SiebelApp->NewPropertySet();
        
        $PS->SetProperty('Prop Par 1', 'Prop Par 1 Value');
        $PS->SetType('This is a type');
        $PS->SetValue('And this is its value');
        $PSChild->SetProperty('Prop Child 1', 'Prop Child 1 Value');
        $PS->AddChild($PSChild);
        
        if($BS->InvokeMethod('Echo', $PS, $Outputs)){
                print "Called BS method Echo, all OK";
        }else{
                print "Failed to call BS method Echo: " . $BS->Error;
        }
        
        
        $SiebelApp->LogOff();

DESCRIPTION

The Siebel::Integration::Com modules are designed to remove the different method calls and error checking between the COM Data Control and COM Data Server interfaces. Changing between the two interfaces only requires a change in the parameters to Siebel::Integration::Com->new() rather than a rewrite of all calls. Beyond just replicating the base functions of the interfaces it is hoped that additional methods will be added to these modules to extend the functionality provided by the Siebel COM framework.

All methods that have been exposed keep the same names so there is no additional learning curve, you can program in Perl using the same method names as eScript

COM Data Control uses the Siebel server (the server must be up and running). This is considered a thin client connection

COM Data Server does not require the Siebel server as it uses the local machine to do the work. This is considered a thick client connection

Base Methods

New(%inputs)
        my %inputs = (
                user => 'SADMIN',
                pass => 'PASSWORD',
                ObjMgr => 'ObjMgr',#thin client only
                ent => 'MYENT',#thin client only
                host => 'MYHOSTNAME',#thin client only
                cfg => 'C:/Siebel/publicsector.cfg',#thick client only
                DataSource => 'ServerDataSrc',#thick client only
        );

        #Thin Client Connection
        
        my $SiebelThin = Siebel::Integration::Com->new(
                        ConnectionType=>'Thin', 
                        UserName=>$inputs{user}, 
                        PassWord=>$inputs{pass}, 
                        Host=>$inputs{host}, 
                        Ent=>$inputs{ent}, 
                        ObjMgr=>$inputs{ObjMgr}
                );
        
        #Thick Client Connection
        
        my $SiebelThick = Siebel::Integration::Com->new(
                        ConnectionType=>'Thick', 
                        UserName=>$inputs{user}, 
                        PassWord=>$inputs{pass}, 
                        CFG=>$inputs{cfg}, 
                        DataSource=>$inputs{DataSource}
                );
        
        Sets SAPP->Error if an error occurs
SAPP->Error
        Returns the error text for the last operation, returns '' if no error.
SAPP->GetProfileAttr(Name)
        Returns the value of the profile attribute. Using an attribute name that does not exist will return ''
        Returns undef for failure. A failure will set SAPP->Error
SAPP->SetProfileAttr(Name, Value)
        Creates or updates a profile attribute
        Returns 1 for success
        Returns undef for failure. A failure will set SAPP->Error
SAPP->LogOff

Only the Thin client actually supports this as a method. Calling this will log off if connection type is Thin and undef the Siebel App OLE for both Thin and Thick clients.

SAPP->GetBusObject(Name)
        Returns a Siebel::Integration::Com::BusObj Object
        Failure to create will set Siebel::Integration::Com::BusObj->Error
SAPP->GetService(Name)
        Returns a Siebel::Integration::Com::BusSrv Object
        Failure to create will set Siebel::Integration::Com::BusSrv->Error
SAPP->NewPropertySet
        Returns a Siebel::Integration::Com::PropSet Object
        Failure to create will set Siebel::Integration::Com::PropSet->Error
SAPP->GetSharedGlobal(Name)
        Returns the value of the shared global. Using a shared global name that does not exist will return ''
        Returns undef for failure. A failure will set SAPP->Error
SAPP->SetSharedGlobal(Name, Value)
        Creates or updates a shared global
        Returns 1 for success
        Returns undef for failure. A failure will set SAPP->Error
SAPP->CurrencyCode
        Returns the currency code that is associated with the division of the user position
SAPP->LoginId
        Returns the login Id of the user who started the Siebel application
SAPP->LoginName
        Returns the login name of the user who started the Siebel application
SAPP->PositionId
        Returns the position Id of the user position
SAPP->PositionName
        Returns the name of the current user position
SAPP->SetPositionId(sPosId)
        Sets the active position to a Position Id
        Returns 1 for success
        Returns undef for failure. A failure will set SAPP->Error
SAPP->SetPositionName(sPosName)
        Sets the active position to a position name
        Returns 1 for success
        Returns undef for failure. A failure will set SAPP->Error
SAPP->InvokeMethod(MethodName, Arg1, Arg2, ArgN)
        B<See Bugs>
        Currently this only allows for 0 or 1 argument to be passed. I have not yet worked out if this is due to me or a fault in the DLL.
        Invokes a method on the application object
SAPP->EnableExceptions(true/false)
        Only in thin client: Enables or disables native COM error handling. Acepts 0 or 1. If using the thick client this call is supressed
SAPP->TraceOff
        Turns tracing off
        Returns 1 for success
        Returns undef for failure. A failure will set SAPP->Error
SAPP->TraceOn(FileName, Type, Selection)
        Starts appliaction tracing
        FileName: Output filename
        Type: [Allocation/SQL]
                Allocation: Traces allocations and deallocations of Siebel objects
                SQL: Traces SQL statements
        Selection: [Script/OLE/All]
                Script: Traces Siebel VB and Siebel eScript objects.
                OLE: Traces allocations for data server or automation server programs.
                All: Traces all objects that Siebel creates as a result of scripting. 
        Returns 1 for success
        Returns undef for failure. A failure will set SAPP->Error
SAPP->Trace(Message)
        Writes the message to the trace file if tracing is on
        Returns 1 for success
        Returns undef for failure. A failure will set SAPP->Error
SAPP->GetLastErrCode
        The error handler that sets SAPP->Error calls this method causing the value to be wiped out. Use SAPP->Error for error details
SAPP->GetLastErrText
        The error handler that sets SAPP->Error calls this method causing the value to be wiped out. Use SAPP->Error for error details
SAPP->ConnectionType
        The current connection type Thin or Thick
SAPP->UserName
        The current user name
SAPP->PassWord
        The current password
SAPP->CFG
        The current CFG file location, only valid for Thick connections
SAPP->DataSource
        The current data source, only valid for Thick connections
SAPP->Host
        The current siebl host, only valid for Thin connections
SAPP->Ent
        The current siebl Enterprise, only valid for Thin connections
SAPP->ObjMgr
        The current siebl Object Manager, only valid for Thin connections

REQUIREMENTS

Windows

Siebel Dedicated Client or more specifically,

sstchca.dll - This provides COM interface to Siebel application. This DLL is provided by Siebel and gets registered on your system when you install Siebel Dedicated (Thick) Client.

The modules will install if the DLL is not present however until the DLL is registered on the system they will not work.

TESTING

WinXP x86 Active State Perl 32 Bit 5.16

Windows 2003x64 Strawberry Perl 32Bit 5.16.2

Siebel 7.7

Siebel 8.1

test.t

test.t has a full set of tests however due to almost all tests requiring a user name and password along with system settings to get the full set of tests you must update the %inputs and %testData variables with the appropriate values. You can then select the tests you wish to preform using the constants at the top of the script.

The test full.t has over 400 tests if all are run in one go this seems to cause problems. Please run only thin or thick client tests at one time. Run standalone (without Test::More) there is no issue but as part of the test suite it just stops after some tests and does not give a report. Any help appreciated in understanding this would be appreciated.

NOTES

The Siebel Application base method Login is called as part of the New method and is not exposed to the user by the resulting Siebel::Integration::Com object

EnableExceptions - only in thin client, thick throws exception, have suppressed call when on thick.

BUGS/LIMITATIONS

InvokeMethod - only takes zero or one argument

SEE ALSO

Siebel::Integration::Com::BusObj

Siebel::Integration::Com::BusComp

Siebel::Integration::Com::BusSrv

Siebel::Integration::Com::PropSet

REFERENCES

Oracle Help Application Methods

Oracle Help Business Component Methods

Oracle Help Property Set Methods

AUTHOR

Kyle Mathers, <kyle.perl at mathersit.com>

COPYRIGHT

Copyright (C) 2013 Kyle Mathers

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.

VERSION

Version 0.02 March 2013