Web Scripts Hello World Quick Start

cancel
Showing results for 
Search instead for 
Did you mean: 

Web Scripts Hello World Quick Start

resplin
Intermediate
0 0 3,335

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.


  1. Log into Alfresco with the username admin and password admin.
  2. Navigate to Company Home > Data Dictionary > Web Scripts (SP5:webscripts) > org > alfresco > sample.

Create the script files


To create the Description Document:

  1. In the Create menu, click Create Content.
  2. Enter the name for the web script in the Name field, for example, hello.get.desc.xml.
  3. In the Content Type list, select XML.
  4. Click Next.
  5. 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>


  1. Click Next.

  2. Click Finish.

  3. Click OK.

To create the Response Template:

  1. In the Create menu, click Create Content.
  2. Enter the name in the Name field, for example, hello.get.html.ftl.
  3. In the Content Type list, select Plain Text.
  4. Click Next.
  5. Paste the following into the Enter Content box:
    Hello ${person.properties.userName}
  6. Click Next.
  7. Click Finish.
  8. Click OK.

Register your new web script


  1. Copy and paste the following into your browser, substituting the hostname and port as necessary:
    http://localhost:8080/alfresco/service/index
  2. Click Refresh list of Web Scripts. You see a message indicating there is one additional web script.

Test your new web script


  1. Copy and paste the following into your browser:
    http://localhost:8080/alfresco/service/sample/hello
  2. If you see a Hello admin message, your web script is working.

See the Web Scripts page for more information on creating web scripts.