AnsweredAssumed Answered

Java backed webscript doesn't show up at all

Question asked by mtielemans on Jun 26, 2013
Latest reply on Jun 27, 2013 by mtielemans
I am following the alfresco wiki's guide to java backed webscripts and cannot get it to work. What's worse, I cannot get as far as generating errors in the logs or otherwise, or a webscript listing in <alfresco>/alfresco/service/index/all.

Other than the wiki example, I am not using an AMP but a jar for my classes. This is because I am bound to adding my webscripts to an existing app that currently builds to a jar.

As far as I understand, there are three major steps in creating a java backed webscript:
<ol><li>Create the java class</li>
<li>Register the bean</li>
<li>Place the descriptor</li></ol>

I implemented this as follows. File locations are relative to the jar's root.

package nl.mark.alfresco.myservice.webscript;

import java.util.HashMap;
import java.util.Map;

import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;

public class GetFooTypes extends DeclarativeWebScript {
    protected Map<String, Object> executeImpl(WebScriptRequest req, Status status) {
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("types", "[\"foo\", \"bar\"]");
        return model;


    <shortname>Retrieve a list of foo types associated to a bar type.</shortname>
    <description>Returns an empty JSON array or a JSON array filled with foo types as Strings, named 'types'.</description>
    <family>Mark cacher</family>


<?xml version='1.0' encoding='UTF-8'?>

    <!– Java backed webscripts –>
    <bean id="" class="nl.mark.alfresco.myservice.webscript.GetFooTypes"

Finally, this jar is placed in alfresco's WEB-INF/lib folder after which the server is restarted. However, the webscript is not available under its URL (404), and I find no mention of anything related in the (awefully clean) logs. It's also not listed in the webscripts index, not even as failed to load. I feel like I am messing up file locations.