FireBoard
Welcome, Guest
Please Login or Register.    Lost Password?
Create document using WebServices (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Create document using WebServices
#679
sparhawk (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Create document using WebServices 6 Months, 2 Weeks ago Karma: 0  
Hi,

I'll put this message in my poor english and spanish, because I see some answers in spanish.

I have an application using Struts, and I want to create (upload) a document reading using Struts Action on the OpenKM repository.

This code is part from a method in a class that recieve a FormFile strutsFormFile parameter, where FormFile is a class from Struts.

OKMDocumentServiceLocator locatorDocument = new OKMDocumentServiceLocator();
OKMDocument document = null;

Document documento = new Document();
document = locatorDocument.getOKMDocumentPort();

Version version = new Version();
version.setActual(true);
version.setCreated(new GregorianCalendar());
version.setAuthor("david";
version.setName("1.0";
documento.setAuthor("david";
documento.setKeywords("keywords";
documento.setLanguage("ES";
documento.setActualVersion(version);
documento.setMimeType(strutsFormFile.getContentType());
documento.setPath("/okm:root/A/Valid/Path";

try {
document.create(token, documento, strutsFormFile.getFileData());
}
catch ( Exception e ) {
}

When I try to upload a PDF file, strutsFormFile.getContentType() is "application/pdf", but I get next Exception

es.git.openkm.core.UnsupportedMimeTypeException: application/octet-stream


I upload pdf files (with MIME/Type application/pdf using the web console without problems, but I cant using WebServices.

Any help?

Hola a todos, tengo un problema con el código que presento arriba. Tengo una aplicación hecha en Struts, que mediante ActionForms y FormFile obtiene un archivo. Quiero subir o crear este archivo en el gestor documental OpenKM. Para ello uso una función como la de arriba que recibe como parámetro el FormFile de Struts. Sin embargo, obtengo una excepción en el content type (el content type que devuelve struts para un archivo pdf es application/pdf)... ¿Qué se me escapa?

Gracias
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#682
sparhawk (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:Create document using WebServices 6 Months, 2 Weeks ago Karma: 0  
I solve the problem... Yo need to pass the name of the file in the path of the Document object, because the webservice use the name of the file in the path to know the mime type.

Regards!
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop