smallredville
Programmer
Hello (=
I tried to run the AddDocument() function, but I kept getting the error message as follows:
Accessed Enterprise Workspace
ParentVol****-2000
ParentID****2000
Status=100402 (0x100402)
Session failure status is 100402 (0x100402)
Message=Required System Attributes
errMsg=
apiError=
End of sample
I have searched forum to find for any sample code, but after I tried the sample code, I still got the same error message.
I do understand from "Appnair" that I could actually use the CreateObjectEx() and CreateVersion() as a replacement of the AddDocument().
I had tried it and it works.
So, I am just curious that is the reason for the AddDocument() does not work, because of my code or anything else.
I hope someone can share with me his/her idea on this issue.
The following is my Java code:
------------------------------------------------------------
package lapi;
import com.opentext.api.*;
public class addDoc {
public static void main(String[] args) {
/*Make a LAPI tunneled call*/
/*Do not know how HTTPS works*/
try {
LLSession session = null;
LAPI_DOCUMENTS documents = null;
int status = 0;
int nodeID = 0;
int parentID = 0;
int nodeVol = 0;
int parentVol = 0;
LLValue pwsInfo = (new LLValue()).setAssocNotSet();
LLValue objInfo = (new LLValue()).setAssocNotSet();
LLValue versionInfo = (new LLValue()).setAssocNotSet();
// Instantiate session object as a SOCKET call
session = new LLSession("localhost", 2099, "", "Admin", "password");
// Instantiate documents object
documents = new LAPI_DOCUMENTS(session);
// Access the user's Personal Workspace
status = documents.AccessEnterpriseWS(pwsInfo);
if (status == 0) {
System.out.println("Accessed Enterprise Workspace");
parentVol = pwsInfo.toInteger("VolumeID");
parentID = pwsInfo.toInteger("ID");
System.out.println("ParentVol****" + parentVol);
System.out.println("ParentID****" + parentID);
}//end if
if (status == 0)
{
// Add document
status = documents.AddDocument(parentVol, parentID,
"test's Document.txt", "c:\\temp\\bravaclientlog.txt",
objInfo, versionInfo);
if (status == 0) {
System.out.println("Added document");
nodeVol = objInfo.toInteger("VolumeID");
nodeID = objInfo.toInteger("ID");
System.out.println("Added document**** details are " + nodeVol + "new nodeID" + nodeID);
}
}
if (status != 0) {
// Display status code in both integer and hex
System.out.println("Status=" + status +
" (0x" + status + ")");
// If the session handle is valid, get the session's error
// information
if (session != null) {
// Get the error information
int stat = session.getStatus();
String message = session.getStatusMessage();
String errMsg = session.getErrMsg();
String apiError = session.getApiError();
System.out.println("Session failure status is " + stat +
" (0x" + stat + ")");
if (message != "" || errMsg != "" || apiError != "") {
System.out.println("Message=" + message);
System.out.println("errMsg=" + errMsg);
System.out.println("apiError=" + apiError);
}
}
}
System.out.println("End of sample");
System.out.println("");
} catch (Exception e) {
// Display exception
System.out.println("Application encountered an exception:");
System.out.println(e.getMessage());
//System.out.println(e.);
}
}
}//end class
------------------------------------------------------------
Many thanks in advance,
smallredville
I tried to run the AddDocument() function, but I kept getting the error message as follows:
Accessed Enterprise Workspace
ParentVol****-2000
ParentID****2000
Status=100402 (0x100402)
Session failure status is 100402 (0x100402)
Message=Required System Attributes
errMsg=
apiError=
End of sample
I have searched forum to find for any sample code, but after I tried the sample code, I still got the same error message.
I do understand from "Appnair" that I could actually use the CreateObjectEx() and CreateVersion() as a replacement of the AddDocument().
I had tried it and it works.
So, I am just curious that is the reason for the AddDocument() does not work, because of my code or anything else.
I hope someone can share with me his/her idea on this issue.
The following is my Java code:
------------------------------------------------------------
package lapi;
import com.opentext.api.*;
public class addDoc {
public static void main(String[] args) {
/*Make a LAPI tunneled call*/
/*Do not know how HTTPS works*/
try {
LLSession session = null;
LAPI_DOCUMENTS documents = null;
int status = 0;
int nodeID = 0;
int parentID = 0;
int nodeVol = 0;
int parentVol = 0;
LLValue pwsInfo = (new LLValue()).setAssocNotSet();
LLValue objInfo = (new LLValue()).setAssocNotSet();
LLValue versionInfo = (new LLValue()).setAssocNotSet();
// Instantiate session object as a SOCKET call
session = new LLSession("localhost", 2099, "", "Admin", "password");
// Instantiate documents object
documents = new LAPI_DOCUMENTS(session);
// Access the user's Personal Workspace
status = documents.AccessEnterpriseWS(pwsInfo);
if (status == 0) {
System.out.println("Accessed Enterprise Workspace");
parentVol = pwsInfo.toInteger("VolumeID");
parentID = pwsInfo.toInteger("ID");
System.out.println("ParentVol****" + parentVol);
System.out.println("ParentID****" + parentID);
}//end if
if (status == 0)
{
// Add document
status = documents.AddDocument(parentVol, parentID,
"test's Document.txt", "c:\\temp\\bravaclientlog.txt",
objInfo, versionInfo);
if (status == 0) {
System.out.println("Added document");
nodeVol = objInfo.toInteger("VolumeID");
nodeID = objInfo.toInteger("ID");
System.out.println("Added document**** details are " + nodeVol + "new nodeID" + nodeID);
}
}
if (status != 0) {
// Display status code in both integer and hex
System.out.println("Status=" + status +
" (0x" + status + ")");
// If the session handle is valid, get the session's error
// information
if (session != null) {
// Get the error information
int stat = session.getStatus();
String message = session.getStatusMessage();
String errMsg = session.getErrMsg();
String apiError = session.getApiError();
System.out.println("Session failure status is " + stat +
" (0x" + stat + ")");
if (message != "" || errMsg != "" || apiError != "") {
System.out.println("Message=" + message);
System.out.println("errMsg=" + errMsg);
System.out.println("apiError=" + apiError);
}
}
}
System.out.println("End of sample");
System.out.println("");
} catch (Exception e) {
// Display exception
System.out.println("Application encountered an exception:");
System.out.println(e.getMessage());
//System.out.println(e.);
}
}
}//end class
------------------------------------------------------------
Many thanks in advance,
smallredville