AnsweredAssumed Answered

unable to execute backup Webscript

Question asked by vincent-kali on Jul 22, 2014
Latest reply on Jul 24, 2014 by romschn
Hi all,
I'm trying to deploy a backend webscript based on the simple example found here https://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples#SimpleWebScript.java ("The World's Simplest Webscript").
But I can't make it working.
-> Web script is registered
-> the "The World's Simplest Webscript", is working fine


I'm getting the following error : (config is detailed below)

thanks for your help !

________________________


The Web Script /core/service/ks2/dlockws/lock 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:   06220001 Cannot locate template processor for template org/alfresco/ks2/dlockws/lock.get.html
   
Exception:   org.springframework.extensions.webscripts.WebScriptException - 06220001 Cannot locate template processor for template org/alfresco/ks2/dlockws/lock.get.html
   
   org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:904)
   org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)
   org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
   org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:429)
   org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
   org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:491)
   org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:529)
   org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:341)
   org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)
   org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

…..
________________________


my class: (jar file <Alfresco>/tomcat/webapps/alfresco/WEB-INF/lib )

package org.alfresco.module.ks2.dlockws;

import ….

public class lock extends org.springframework.extensions.webscripts.DeclarativeWebScript {
   
    public void executeImpl (WebScriptRequest req, WebScriptResponse res)
        throws IOException
    {
       
       …
       
       try
       {
          
         if (req.getParameter("a") == null || req.getParameter("a").length() == 0)
         {
            
            status.setCode(HttpServletResponse.SC_BAD_REQUEST);
            status.setMessage("no parameter");
            status.setRedirect(true);
            return;
         }
         else
         {
            status.setCode(HttpServletResponse.SC_OK );
            message = "param a=" + req.getParameter("a");
            status.setMessage(message);
            status.setRedirect(true);
            return;         
         }
       }
       catch(Exception e)
       {
          //throw new WebScriptException("Unable to serialize JSON");
          status.setCode(HttpServletResponse.SC_FORBIDDEN);
          status.setMessage("Invalid username & password");
          status.setException(e);
          status.setRedirect(true);
      }
    }

   ……
}

________________________


lock.get.desc.xml content: (file in <Alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/module/ks2/dlockws )



<webscript>
  <shortname>lock</shortname>
  <description>dLock Web Service, methode lock</description>
  <url>/ks2/dlockws/lock</url>
  <authentication>admin</authentication>
  <family>ks2 Web Scripts</family>
</webscript>

________________________

web script declaration: (in file <Alfresco>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/web-scripts-application-context.xml

<bean id="webscript.org.alfresco.ks2.dlockws.lock.get"
      class="org.alfresco.module.ks2.dlockws.lock"
      parent="webscript">
</bean>

_________________________










Outcomes