RestDocumentClient.create() throws ResponseProcessingException while calling Rest from Java to create a document on DMS
Posted: Wed Jun 06, 2018 7:50 am
Hi,
I am trying to call LogicalDOC rest api to create document on DMS. I am invoking rest from java using RestDocumentClient.
When using RestDocumentClient.create(), it is throwing ResponseProcessingException because of which I get null object in return. I need to get document id from wsdocument object.
Anyone has any idea? I am using logical doc 7.6.4.
Here is my sample Code:
===========================================
RestDocumentClient restClient = new RestDocumentClient("http://localhost:8085/services/rest" + "/document",
"admin", "admin");
File file = new File("D:\\Vivek\\database_t2.properties");
WSDocument wsdocument = new WSDocument();
long docid = 5537792;
wsdocument.setFolderId(docid);
wsdocument.setFileName(file.getName());
WSDocument createdDoc = null;
try {
createdDoc = restClient.create(wsdocument, file);
System.out.println("Document ID is : >>" + createdDoc.getId());
} catch (ResponseProcessingException e) {
LOGGER.info("Letter ["+file.getName()+"] uploaded in DMS");
} catch (Exception e) {
LOGGER.error("Error occurred while uploading file [" + file.getName() + "] to DMS.");
}
==================================================
I am trying to call LogicalDOC rest api to create document on DMS. I am invoking rest from java using RestDocumentClient.
When using RestDocumentClient.create(), it is throwing ResponseProcessingException because of which I get null object in return. I need to get document id from wsdocument object.
Anyone has any idea? I am using logical doc 7.6.4.
Here is my sample Code:
===========================================
RestDocumentClient restClient = new RestDocumentClient("http://localhost:8085/services/rest" + "/document",
"admin", "admin");
File file = new File("D:\\Vivek\\database_t2.properties");
WSDocument wsdocument = new WSDocument();
long docid = 5537792;
wsdocument.setFolderId(docid);
wsdocument.setFileName(file.getName());
WSDocument createdDoc = null;
try {
createdDoc = restClient.create(wsdocument, file);
System.out.println("Document ID is : >>" + createdDoc.getId());
} catch (ResponseProcessingException e) {
LOGGER.info("Letter ["+file.getName()+"] uploaded in DMS");
} catch (Exception e) {
LOGGER.error("Error occurred while uploading file [" + file.getName() + "] to DMS.");
}
==================================================