AnsweredAssumed Answered

Unable to create document via REST service

Question asked by piyush on May 25, 2009
Latest reply on May 26, 2009 by piyush
Hi,

I am unable to get any of the operations working that use HTTP POST method.  If however the same (RESTful) request is sent via GET it is working.

e.g.  If I try to get the list of checkedout file, the API to be used is (GET request):

http://localhost:8080/alfresco/service/api/checkedout

This works perfectly fine, and I get the response with the list of documents that are checked out.

However, If I want to check if a specific document is checked out, the same request is to be sent via a POST with documentId as the input parameter.

In this case, I am getting the following error:

  Web Script Status 500 - Internal Error  

The Web Script /alfresco/service/api/checkedout has responded with a status of 500 - Internal Error. 

500 Description:  An error inside the HTTP server which prevented it from fulfilling the request.
 
Message:  Wrapped Exception (with status template): IO Error during processing of the template 'org/alfresco/repository/store/checkedout.post.atomentry.ftl'. Please contact your system administrator.
  
Exception:  java.io.FileNotFoundException - Template org/alfresco/repository/store/checkedout.post.atomentry.ftl not found.
  
freemarker.template.Configuration.getTemplate(Configuration.java:489)
freemarker.template.Configuration.getTemplate(Configuration.java:452)
org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:194)
org.alfresco.web.scripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:532)
org.alfresco.web.scripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:241)
org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:319)
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:322)
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:229)
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:368)
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:390)
org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:273)
org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:261)
org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:139)
org.alfresco.web.scripts.servlet.WebScriptServlet.service(WebScriptServlet.java:122)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:595)
  
Exception:  org.alfresco.service.cmr.repository.TemplateException - IO Error during processing of the template 'org/alfresco/repository/store/checkedout.post.atomentry.ftl'. Please contact your system administrator.
  
org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:221)
  
Exception:  org.alfresco.web.scripts.WebScriptException - Wrapped Exception (with status template): IO Error during processing of the template 'org/alfresco/repository/store/checkedout.post.atomentry.ftl'. Please contact your system administrator.
  
org.alfresco.web.scripts.AbstractWebScript.createStatusException(AbstractWebScript.java:622)
  
Server :  Alfresco Enterprise v3.1.0 (142) schema 1,008
Time :  May 25, 2009 6:19:20 PM
  
Diagnostics :  Inspect Web Script (org/alfresco/repository/store/checkedout.post) 

Another example of a similar problem is when I am trying to create a document using createDocument  REST call.  This time there is a bad request error happening:

  Web Script Status 400 - Bad Request  

The Web Script /alfresco/service/api/path/workspace/SpacesStore/Company Home/children has responded with a status of 400 - Bad Request. 

400 Description:  Request sent by the client was syntactically incorrect.
 
Message:  Posting of media resource not supported
Server :  Alfresco Enterprise v3.1.0 (142) schema 1,008
Time :  May 25, 2009 5:43:03 PM
  
Diagnostics :  Inspect Web Script (org/alfresco/repository/store/children.post) 
Any suggestions?

-Piyush

Outcomes