smallredville
Programmer
Hi everyone,
I tried to use createObjectEx and createVersion subsequently.
But could create the object but it failed to create version.
The following is the error message:
Document Added Successfully
Version not added
Status Code: 101607
Api Error:
Error Message:
Status Message: Object is not a document application type
----------------------------------------------------------
The source code is below:
package LAPI;
import com.opentext.api.*;
public class createObjEx {
private static String Server = "localhost";
private static int Port = 2099;
private static String DFT = "";
private static String User = "Admin";
private static String Pass = "password";
public static void main (String [] args)
{
try
{
//variables
LLSession session;
LAPI_DOCUMENTS doc;
LLValue entInfo= new LLValue();
LLValue createInfo = new LLValue().setAssoc();
LLValue objectInfo = new LLValue().setAssoc();
session = new LLSession (Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS (session);
int volumeID,objectID,objID;
String objName, FilePath;
if(doc.AccessEnterpriseWS(entInfo) != 0)
{
System.out.println("AccessEnterpriseWS Failed.");
return;
}
else
{
volumeID = entInfo.toInteger("VolumeID");
objectID = entInfo.toInteger("ID");
System.out.println("Enterprise Volume"+volumeID+"Enterprise ObjID"+objectID);
}
//volumeID = 0;
//objID = 2000;
objName = "HelloWORLD17.doc";
FilePath = "C:\\yoyo\\doc_1.doc";
if (doc.CreateObjectEx(volumeID, objectID, LAPI_DOCUMENTS.OBJECTTYPE, LAPI_DOCUMENTS.DOCUMENTSUBTYPE, objName,createInfo, objectInfo) == 0)
{
System.out.println("Document Added Successfully");
LLValue version_info = (new LLValue()).setAssoc();
int new_ObjectID = entInfo.toInteger("ID");
//upon successful creation of objects
if(doc.CreateVersion(volumeID, new_ObjectID, FilePath, version_info)==0)
System.out.println("Version added");
else
{
System.out.println("Version not added");
System.out.println("Status Code: " + session.getStatus());
System.out.println("Api Error: " + session.getApiError());
System.out.println("Error Message: " + session.getErrMsg());
System.out.println("Status Message: " + session.getStatusMessage());
}
}
else
{
System.out.println("Failed to Add Document");
//Error Checking
System.out.println("Status Code: " + session.getStatus());
System.out.println("Api Error: " + session.getApiError());
System.out.println("Error Message: " + session.getErrMsg());
System.out.println("Status Message: " + session.getStatusMessage());
}
}
catch (Throwable e)
{
System.err.println(e.getMessage());
e.printStackTrace (System.err);
}
}//main ends
}//class ends
-----------------------------------------------------------
Any helps/suggestions are greatly appreciated (^o^)
Many thanks in advance,
smallredville
I tried to use createObjectEx and createVersion subsequently.
But could create the object but it failed to create version.
The following is the error message:
Document Added Successfully
Version not added
Status Code: 101607
Api Error:
Error Message:
Status Message: Object is not a document application type
----------------------------------------------------------
The source code is below:
package LAPI;
import com.opentext.api.*;
public class createObjEx {
private static String Server = "localhost";
private static int Port = 2099;
private static String DFT = "";
private static String User = "Admin";
private static String Pass = "password";
public static void main (String [] args)
{
try
{
//variables
LLSession session;
LAPI_DOCUMENTS doc;
LLValue entInfo= new LLValue();
LLValue createInfo = new LLValue().setAssoc();
LLValue objectInfo = new LLValue().setAssoc();
session = new LLSession (Server, Port, DFT, User, Pass);
doc = new LAPI_DOCUMENTS (session);
int volumeID,objectID,objID;
String objName, FilePath;
if(doc.AccessEnterpriseWS(entInfo) != 0)
{
System.out.println("AccessEnterpriseWS Failed.");
return;
}
else
{
volumeID = entInfo.toInteger("VolumeID");
objectID = entInfo.toInteger("ID");
System.out.println("Enterprise Volume"+volumeID+"Enterprise ObjID"+objectID);
}
//volumeID = 0;
//objID = 2000;
objName = "HelloWORLD17.doc";
FilePath = "C:\\yoyo\\doc_1.doc";
if (doc.CreateObjectEx(volumeID, objectID, LAPI_DOCUMENTS.OBJECTTYPE, LAPI_DOCUMENTS.DOCUMENTSUBTYPE, objName,createInfo, objectInfo) == 0)
{
System.out.println("Document Added Successfully");
LLValue version_info = (new LLValue()).setAssoc();
int new_ObjectID = entInfo.toInteger("ID");
//upon successful creation of objects
if(doc.CreateVersion(volumeID, new_ObjectID, FilePath, version_info)==0)
System.out.println("Version added");
else
{
System.out.println("Version not added");
System.out.println("Status Code: " + session.getStatus());
System.out.println("Api Error: " + session.getApiError());
System.out.println("Error Message: " + session.getErrMsg());
System.out.println("Status Message: " + session.getStatusMessage());
}
}
else
{
System.out.println("Failed to Add Document");
//Error Checking
System.out.println("Status Code: " + session.getStatus());
System.out.println("Api Error: " + session.getApiError());
System.out.println("Error Message: " + session.getErrMsg());
System.out.println("Status Message: " + session.getStatusMessage());
}
}
catch (Throwable e)
{
System.err.println(e.getMessage());
e.printStackTrace (System.err);
}
}//main ends
}//class ends
-----------------------------------------------------------
Any helps/suggestions are greatly appreciated (^o^)
Many thanks in advance,
smallredville