Session Class Methods
In this section, we discuss the Session class methods. The methods are discussed in alphabetical order.
Syntax
(version, {"EXISTING" | //PSoftApplicationServer:JoltPort}, UserID, Password, ExtAuth)
Description
The Connect method connects a session object to a PeopleSoft application server.
Note: This function remains for backward compatibility only. Use the %Session system variable to return a reference of a session object instead.
If you already have a PeopleSoft session running (you are already connected to a PeopleSoft application server and are running a component, and so on) you must specify EXISTING, and not the //PSoftApplicationServer:JoltPort. Typically, use the parameter value of EXISTING from PeopleCode, not from other language environments.
If you are using an existing connection to the application server, you cannotspecify a different user ID or password. If you don’t specify these values as NULL string, you must specify the exact same user ID (and password) as the one that originally started the session.
Parameters
Field or Control |
Definition |
---|---|
version |
Specify the API version that the client is expecting. Future releases will use this parameter. For now, you must use a 1. |
EXISTING | //PSoftApplicationServer:JoltPort |
Specify EXISTING if you’re currently connected to an application server. Otherwise, specify the named application server machine and the IP port to connect to on an application server machine. |
UserID |
Specify the PeopleSoft user ID to use for the connection. This must be a valid user ID. If you are using an existing connection, you can specify a NULL string (that is, two quotation marks with no blank space between them ("")) for this parameter. |
Password |
Specify the password associated with the user ID to use for the connection. This must match the password assigned for this user ID exactly. If you are using an existing connection, you can specify a NULL string (that is, two quotation marks with no blank space between them ("")) for this parameter. |
ExtAuth |
This parameter is required, but it is unused in this release. You must enter a 0 for this parameter. |
Returns
A Boolean value: True if the connection completed successfully, False otherwise.
Example
The following is an example of the code you would use if there is an existing connection to the application server:
Local ApiObject &MYSESSION;
&MYSESSION = GetSession();
&MYSESSION.Connect(1, "EXISTING", "", "", 0);
The following is an example connecting to a PeopleSoft system using a Visual Basic program. It first checks for error messages. If there are any errors, the text of the error is displayed to the user.
On Error GoTo eMessage
Dim oSession As Object
Dim oPSMessage As Object
Dim oBC As Object
Set oSession = CreateObject("PeopleSoft.Session")
oSession.Connect 1, "//PSSOFTO061998:7000", "PTDMO", "PTDMO", 0
‘Application Specific Processing
eMessage:
If (oSession.PSMessages.Count > 0) Then
For i = 1 To oSession.PSMessages.Count
Set oPSMessage = oSession.PSMessages.Item(i)
MsgBox (oPSMessage.Text)
Next i
End If
Syntax
Disconnect()
Description
The Disconnect method disconnects the session associated with the session object executing the method from that PeopleSoft session.
This method returns a Boolean value: True if successfully disconnected, False otherwise.