Logon Function

In this section:

This topic describes the Logon function and provides examples for it.


Top of page

x
Logging on to ReportCaster

Function Name: logon

Purpose: Accepts a user name and a password. It returns a string representing a security token. This token is then set in a corresponding Authenticate object.

Input

Description

Type

User name.

String

Password.

String

Output

Description

Type

Represents the security token associated with this logon.

String



Example: Logging on to ReportCaster in Visual Basic .NET

In the following example, a user is logged on to ReportCaster and the security token is set. The security token is then used as part of the Authenticate structure. The Authenticate structure is the first parameter to all other ReportCaster Web Service functions. The security token is written to the RCsecToken.txt file.

Try
   Dim RCLogon As New LogonManager.LogonManagerWSService
   Dim SecToken As String
   Dim tempfile As String
   Dim newOutput As String
   SecToken = RCLogon.logon("admin", "")
   tempfile = "d:\RCtemp\RCsecToken.txt"
   FileOpen(1, tempfile, OpenMode.Output)
   newOutput = SecToken
   PrintLine(1, newOutput)
   FileClose(1)
   Catch x As Exception
       MsgBox(x.Message, MsgBoxStyle.OKOnly, "Error Message")
End Try 


Example: Logging on to ReportCaster in Java

In the following example, a user is logged on to ReportCaster and the security token is set. The security token is then used as part of the Authenticate structure. The Authenticate structure is the first parameter to all other ReportCaster Web Service functions. The security token is written to the RCsecToken.txt file.

try
{
LogonManagerWSService LogonService = new LogonManagerWSServiceLocator();
LogonManagerWS RCLogon = LogonService.getLogonService();
String sectoken = RCLogon.logon("admin","");
File tempfile = new File("d:\\RCtemp\\RCsecToken.txt");
FileOutputStream fos = new FileOutputStream(tempfile);
PrintWriter out=new PrintWriter(fos);
String newOutput = sectoken;
out.println(newOutput);
out.close();
}
catch (Throwable t)
{
  System.err.println(t);
  t.printStackTrace();
  System.exit(1);
} 

WebFOCUS