Search code examples
alfrescoalfresco-webscripts

Register webscript in alfresco 5


I'd like to register a custom webscript in a alfresco 5 installation. To get a grip on the matter i started with this turorial: http://docs.alfresco.com/5.0/tasks/ws-config.html

It basically says: Login as admin, go to Data Dictionary > Web Scripts Extensions > org > example, place some xml files plus a .ftl file for presentation. In the end it directs one to http://localhost:8080/alfresco/service/index and perfom a Refresh Web Scripts.

The result of this always is:

Maintenance Completed
Reset Web Scripts Registry; registered 505 Web Scripts. Previously, there were 505.

And no trace of my fancy hello world script.

I also tried to manually place the files in /var/lib/tomcat7/shared/classes/alfresco/extension. Also a restart of tomcat lead to no different result (did you try to turn it on and off again...).

It really frustrating as the documentation seems to be simple enough.


What i tried also in detail

Taken from (Alfresco Developer: Intro to the Web Script Framework by Jeff Potts)

Navigate to /Company Home/Data Dictionary/Web Scripts Extensions

Create a file called helloworld.get.desc.xml with the following content:

<webscript>
    <shortname>Hello World</shortname>
    <description>Hello world web script</description>
    <url>/helloworld?name={nameArgument}</url>
</webscript>

Create a file called helloworld.get.html.ftl with the following content:

<html>
    <body>
        <p>Hello, ${args.name}!</p>
    </body>
</html>

... Do refresh Web scripts.

As you can see this is a pretty tough implementation ... But even it's that simple it just is not working. Where could I possible have turned wrong?

Any heads up is greatly appreciated.


Solution

  • There are 2 approach using which we can deploy webscript in alfresco.

    1.Placing webscript inside DataDictionary
    2.Placing webscript inside extension folder

    In case of your code you are placing files in wrong folder.Below are correct location for each deployment approach.

  • Location for Data Dictionary

    /Data Dictionary/Web Scripts/org/alfresco
    

  • Location for extension

    tomcat\shared\classes\alfresco\extension\templates\webscripts