Web Scripts Hello World Quick Start
From AlfrescoWiki
Back to Web Scripts.
This page gives step by step instructions for creating your first Web Script.
Contents |
[edit] Getting started
You need a working Alfresco. I used 2.1 CE but it should work on anything later. (PLEASE NOTE: With Alfresco v2.1 SP5, the default web scripts folder has been renamed "webscripts")
- Log into Alfresco with the username
adminand passwordadmin. - Navigate to Company Home > Data Dictionary > Web Scripts (SP5:webscripts) > org > alfresco > sample.
[edit] Create the script files
- To create the Description Document
- In the Create menu, click Create Content.
- Enter the name for the web script in the Name field, for example,
hello.get.desc.xml. - In the Content Type list, select XML.
- Click Next.
- Copy and paste the following into the Enter Content box:
<webscript> <shortname>Hello</shortname> <description>Polite greeting</description> <url>/sample/hello</url> <authentication>user</authentication> </webscript>
- Click Next.
- Click Finish.
- Click OK.
- To create the Response Template
- In the Create menu, click Create Content.
- Enter the name in the Name field, for example,
hello.get.html.ftl. - In the Content Type list, select Plain Text.
- Click Next.
- Paste the following into the Enter Content box:
Hello ${person.properties.userName} - Click Next.
- Click Finish.
- Click OK.
[edit] Register your new web script
- Copy and paste the following into your browser, substituting the hostname and port as necessary:
http://localhost:8080/alfresco/service/index - Click Refresh list of Web Scripts. You see a message indicating there is one additional web script.
[edit] Test your new web script
- Copy and paste the following into your browser:
http://localhost:8080/alfresco/service/sample/hello - If you see a Hello admin message, your web script is working.
See the Web Scripts page for more information on creating web scripts.

