cancel
Showing results for 
Search instead for 
Did you mean: 

REST - Can't get checkout to work

tdinger
Champ in-the-making
Champ in-the-making
I'm developing a CMIS client for retrieving information from multiple back ends. The client is written in Java, but does not use any frameworks like OpenCMIS, etc. I'm simply using the repository information to generate HTTP requests for the various services.

I'm having trouble getting the checkout service to work on the public alfresco server. I'm using the collection URL for checked out documents – http://cmis.alfresco.com:80/service/cmis/checkedout. I'm POSTing the <entry> for the document I want to check out. The <allowableActions> for this entry say that checkout is allowed. I've added a request header to specify that the content-type is "application/atom+xml;type=entry". I can't think of anything else necessary.

The response is below. Seems like a server problem, but I've seen this kind of response when the server is expecting something different in the request. Can anyone help with this?

—————————————————————————————————————————————————

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title>Web Script Status 500 - Internal Error</title>
      <link rel="stylesheet" href="/css/webscripts.css" type="text/css" />
   </head>
   <body>
      <div>
         <table>
            <tr>
               <td><img src="/images/logo/AlfrescoLogo32.png" alt="Alfresco" /></td>
               <td><span class="title">Web Script Status 500 - Internal Error</span></td>
            </tr>
         </table>
         <br/>
         <table>
            <tr><td>The Web Script <a href="%2Fservice%2Fcmis%2Fcheckedout">/service/cmis/checkedout</a> has responded with a status of 500 - Internal Error.</td></tr>
         </table>
         <br/>
         <table>
            <tr><td><b>500 Description:</b></td><td> An error inside the HTTP server which prevented it from fulfilling the request.</td></tr>
            <tr><td> </td></tr>
            <tr><td><b>Message:</b></td><td>00192132 Cannot locate template processor for template org/alfresco/cmis/checkedout.post.atomentry</td></tr>
            <tr><td></td><td> </td></tr>
   <tr><td><b>Exception:</b></td><td>org.springframework.extensions.webscripts.WebScriptException - 00192132 Cannot locate template processor for template org/alfresco/cmis/checkedout.post.atomentry</td></tr>
   <tr><td></td><td> </td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:587)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:383)</td></tr>
         <tr><td></td><td>org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:381)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)</td></tr>
         <tr><td></td><td>org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)</td></tr>
         <tr><td></td><td>org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)</td></tr>
         <tr><td></td><td>javax.servlet.http.HttpServlet.service(HttpServlet.java:717)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</td></tr>
         <tr><td></td><td>org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)</td></tr>
         <tr><td></td><td>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)</td></tr>
         <tr><td></td><td>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)</td></tr>
         <tr><td></td><td>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)</td></tr>
         <tr><td></td><td>org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)</td></tr>
         <tr><td></td><td>org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)</td></tr>
         <tr><td></td><td>org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)</td></tr>
         <tr><td></td><td>java.lang.Thread.run(Thread.java:619)</td></tr>
   <tr><td></td><td> </td></tr>
            <tr><td><b>Server</b>:</td><td>Community v3.4.0 (b @build-number@) schema 4,111</td></tr>
            <tr><td><b>Time</b>:</td><td>19-Jan-2011 22:09:26</td></tr>
            <tr><td></td><td> </td></tr>
            <tr><td><b>Diagnostics</b>:</td><td><a href="/service/script/org/alfresco/cmis/checkedout.post">Inspect Web Script (org/alfresco/cmis/checkedout.post)</a></td></tr>
         </table>
      </div>
   </body>
</html>
3 REPLIES 3

seanlon11
Champ in-the-making
Champ in-the-making
Could you please post your code for this issue?

tdinger
Champ in-the-making
Champ in-the-making
It's not really a "code" issue, since I'm just trying to make the HTTP request against the alfresco server. I'm using REST Client in Firefox to make the request.

Anyway it's working now for the same request, so I'd assume a fix was added to the public Alfresco server.

jpotts
World-Class Innovator
World-Class Innovator
Old thread, but thought I'd respond anyway as multiple people have asked me for this info lately…

The three ingredients to successfully checking out a doc via CMIS and the restful Atom Pub binding are:

1. Posting to the correct "checkedout" URL, which is: http://localhost:8080/alfresco/s/cmis/checkedout
2. Setting the correct content-type in the header, which is: 'content-type:application/atom+xml;type=entry'
3. Posting the appropriately formatted Atom entry to the collection. An example appears below:

<?xml version="1.0" ?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/">
<cmisra:object xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/">
<cmis:properties>
<cmis:propertyId propertyDefinitionId="cmis:objectId">
<cmis:value>workspace://SpacesStore/81d28461-58a9-4a23-a49c-97db9a518040</cmis:value>
</cmis:propertyId>
</cmis:properties>
</cmisra:object>
</entry>

Assuming the XML was in a file called test.xml, you could use the following curl command to check out the document:
curl -X POST -uadmin:admin -H 'content-type:application/atom+xml;type=entry' 'http://localhost:8080/alfresco/s/cmis/checkedout' -d@/Users/jpotts/Desktop/test.xml

I suppose a key fourth ingredient is that the document's "canCheckOut" allowable action is returning true before the checkout is attempted.

Hope this helps,

Jeff