Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Error in executing CreateUser()
William_Teo_(sbspte01user3_-_(deleted))
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 usererrtext : 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,devita///////////////////////////////////////////////////////////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}
Find more posts tagged with
Comments
Bhupinder_Singh
Message from Bhupinder Singh <
bsingh@opentext.com
> via eLink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">eLink
Are you able to successfully create new users via the regular Livelink user interface?
- Bhupinder
From:
eLink Discussion: LAPI Discussion [mailto:lapi@elinkkc.opentext.com]
Sent:
Tuesday, November 18, 2008 2:50 AM
To:
eLink Recipient
Subject:
Error in executing CreateUser()
Error in executing CreateUser()
Posted by
sbspte01user3
(Teo, William) on 11/18/2008 02:48 AM
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,
devita
///////////////////////////////////////////////////////////
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
}