Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a bug in AddDocument() method 1

Status
Not open for further replies.

smallredville

Programmer
Aug 18, 2008
115
SG
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
 
Hi addDocument if you read the documentation combines createobjectex and createversion in one shot.Places where it will not work are instances like this.

You are trying to addDocument in a folder that has a mandatory user category:attribute.

You are trying to addDocument in a folder that has a additional node attribute.

Simply put you are hitting a chicken and egg situation where the business rules dictate that you should not be able to create object until all metadata is done,but addcoument cannot handle additional metadata.

There are easier high level java lapi packages that beneath the covers emulate adddocument with category support.search in the KB for Easylapi or slapi.

From 9.7.1 if you are on it most api functions are accessible viz a viz webservices as well.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
I used the code that you posted under the two diff conditions are the errors are just what you get

//Adding a document where there is no category this code worked just fine

C:\javalapi>java addDoc
Accessed Enterprise Workspace
ParentVol****-2000
ParentID****2000
Added document
Added document**** details are -2000new nodeID216116
End of sample

//Adding a document where there is a category and one Attribute is mandatory

C:\javalapi>javac addDoc.java

C:\javalapi>java addDoc
Accessed Enterprise Workspace
ParentVol****-2000
ParentID****2000
Status=100404 (0x100404)
Session failure status is 100404 (0x100404)
Message=Error Creating node
errMsg=Documentation Code is a required field.
apiError=
End of sample

//Adding a document where there a required SYSTEM ATTRIBUTE

C:\javalapi>javac addDoc.java

C:\javalapi>java addDoc
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


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top