Obsolete Pages{{Obsolete}}
The official documentation is at: http://docs.alfresco.com
Web ScriptsGetting Started
Back to Web Scripts.
This page gives step by step instructions for creating your first Web Script.
Getting started
You need a working Alfresco. I used 2.1 CE but it should work on anything later.
- Log into Alfresco with the username
admin
and password admin
.
- Navigate to Company Home > Data Dictionary > Web Scripts (SP5:webscripts) > org > alfresco > sample.
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.
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.
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.