smallredville
Programmer
Hi All,
Recently I tried to test the CreateUser() which I got from KB.
However when I ran it in my image, I got the following errors:
statustext : Error creating new user
errtext : OnTime: Could not communicate with the OnTime Calendaring service. (-1)
Hope somebody who has any idea, can share with me on how to deal with this error message.
Many thanks in advance,
smallredville
///////////////////////////////////////////////////////////
Code is shown below:
///////////////////////////////////////////////////////////
import com.opentext.api.*;
public class createUser
{
// Declare some constants for the user and group to add
// In production, your code would read a file where this information is stored.
public static final String USER_NAME = "imauser";
public static final String USER_PASS = "livelink";
public static final String USER_FIRST = "Ima";
public static final String USER_LAST = "User";
public static final String USER_GROUP = "All_Athena_Users";
public static void main( String[] args )
{
try
{
// Declare some local fields
LLSession session;
int status;
// Get the session - Hard coded here but you may want to prompt the user
session = new LLSession( "localhost", 2099, "", "Admin", "password" );
LAPI_USERS users = new LAPI_USERS( session );
// Declare some value objects
// Note that some have their type declared and some do not. Why?
LLValue userData = ( new LLValue() ).setAssocNotSet();
LLValue id = ( new LLValue() );
LLValue row = ( new LLValue() ).setAssocNotSet();
// There are more fields in row than these. What are they?
//row.add( "LastName", USER_LAST );
//row.add( "FirstName", USER_FIRST );
// Create the user if you can.
// You may wish to call the GetUserInfo() method to test for the
// existence of this user before creating. CreateUser() will fail
// if the user already exists.
status = users.CreateUser( USER_NAME, USER_PASS,
LAPI_USERS.PRIV_LOGIN | LAPI_USERS.PRIV_UAPI_SESSION |
LAPI_USERS.PRIV_DAPI_SESSION | LAPI_USERS.PRIV_WAPI_SESSION | LAPI_USERS.PRIV_PERM_WORLD,
userData, LAPI_USERS.GROUP, USER_GROUP, row, id );
if ( status != 0 )
{
String statustext = session.getStatusMessage();
String errtext = session.getErrMsg();
String apitext = session.getApiError();
System.out.println("statustext : " + statustext);
System.out.println("errtext : " + errtext);
System.out.println("apitext : " + apitext);
System.out.println( "\nERROR: " + statustext + "\n" + errtext + "\n" + apitext );
} else {
System.out.println( "\nSUCCESS: New user " + USER_NAME + " has been added" );
}
}
catch ( Throwable e )
{
String x = e.getClass().getName();
String s = e.getMessage();
e.printStackTrace();
}
} // end main
}
Recently I tried to test the CreateUser() which I got from KB.
However when I ran it in my image, I got the following errors:
statustext : Error creating new user
errtext : OnTime: Could not communicate with the OnTime Calendaring service. (-1)
Hope somebody who has any idea, can share with me on how to deal with this error message.
Many thanks in advance,
smallredville
///////////////////////////////////////////////////////////
Code is shown below:
///////////////////////////////////////////////////////////
import com.opentext.api.*;
public class createUser
{
// Declare some constants for the user and group to add
// In production, your code would read a file where this information is stored.
public static final String USER_NAME = "imauser";
public static final String USER_PASS = "livelink";
public static final String USER_FIRST = "Ima";
public static final String USER_LAST = "User";
public static final String USER_GROUP = "All_Athena_Users";
public static void main( String[] args )
{
try
{
// Declare some local fields
LLSession session;
int status;
// Get the session - Hard coded here but you may want to prompt the user
session = new LLSession( "localhost", 2099, "", "Admin", "password" );
LAPI_USERS users = new LAPI_USERS( session );
// Declare some value objects
// Note that some have their type declared and some do not. Why?
LLValue userData = ( new LLValue() ).setAssocNotSet();
LLValue id = ( new LLValue() );
LLValue row = ( new LLValue() ).setAssocNotSet();
// There are more fields in row than these. What are they?
//row.add( "LastName", USER_LAST );
//row.add( "FirstName", USER_FIRST );
// Create the user if you can.
// You may wish to call the GetUserInfo() method to test for the
// existence of this user before creating. CreateUser() will fail
// if the user already exists.
status = users.CreateUser( USER_NAME, USER_PASS,
LAPI_USERS.PRIV_LOGIN | LAPI_USERS.PRIV_UAPI_SESSION |
LAPI_USERS.PRIV_DAPI_SESSION | LAPI_USERS.PRIV_WAPI_SESSION | LAPI_USERS.PRIV_PERM_WORLD,
userData, LAPI_USERS.GROUP, USER_GROUP, row, id );
if ( status != 0 )
{
String statustext = session.getStatusMessage();
String errtext = session.getErrMsg();
String apitext = session.getApiError();
System.out.println("statustext : " + statustext);
System.out.println("errtext : " + errtext);
System.out.println("apitext : " + apitext);
System.out.println( "\nERROR: " + statustext + "\n" + errtext + "\n" + apitext );
} else {
System.out.println( "\nSUCCESS: New user " + USER_NAME + " has been added" );
}
}
catch ( Throwable e )
{
String x = e.getClass().getName();
String s = e.getMessage();
e.printStackTrace();
}
} // end main
}