cancel
Showing results for 
Search instead for 
Did you mean: 

[LABS3] problem WEB SCRIPT SIMPLE

yang
Champ in-the-making
Champ in-the-making
Hello,

I am french people and i write and speak very bad english but I go to try to explain my problem

I read book of MUNWAR SHARIFF and i try to execute web script simple

file greeting.get.desc.xml


    <webscript>
       <shortname>Bienvenue</shortname>
       <description>Formule de politesse</description>
       <url>/sample/greeting</url>
       <authentification>user</authentification>
    </webscript>



File greeting.get.html.ftl

   Hello ${person.properties.username}




I followed the step
When i execute http://localhost:8080/alfresco/service/sample/greeting
i obtain error :

   The Web Script /alfresco/service/sample/greeting has responded with a status of 500 - Erreur Interne de Servlet.

    500 Description:   Le serveur a recontrer une erreur interne qui l''a empêché de satisfaire la requête.

    Message:   Wrapped Exception (with status template): Error during processing of the template 'Expression person is undefined on line 1, column 9 in org/alfresco/sample/greeting.get.html.ftl.'. Veuillez contacter votre administrateur système.
      
    Exception:   freemarker.core.InvalidReferenceException - Expression person is undefined on line 1, column 9 in org/alfresco/sample/greeting.get.html.ftl.
      
       freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)


Thank you for help
5 REPLIES 5

mrogers
Star Contributor
Star Contributor
The property name is case sensitive, try "userName" instead.

http://wiki.alfresco.com/wiki/Web_Scripts_Hello_World_Quick_Start

yang
Champ in-the-making
Champ in-the-making
Hello,

I update file
Hello ${person.properties.userName}
but i have allways prob
The Web Script /alfresco/service/sample/greeting has responded with a status of 500 - Erreur Interne de Servlet.

500 Description:   Le serveur a recontrer une erreur interne qui l''a empêché de satisfaire la requête.

Message:   Wrapped Exception (with status template): Error during processing of the template 'Expression person is undefined on line 1, column 9 in org/alfresco/sample/greeting.get.html.ftl.'. Veuillez contacter votre administrateur système.
   
Exception:   freemarker.core.InvalidReferenceException - Expression person is undefined on line 1, column 9 in org/alfresco/sample/greeting.get.html.ftl.
   
   freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
   freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
   freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
   freemarker.core.Expression.getAsTemplateModel(Expression.java:89)

When i update file , i execute http://localhost:8080/alfresco/service/index and button 'Refresh Web Script'

Thank you for help

mrogers
Star Contributor
Star Contributor
I just double checked the instructions on the wiki page above are still correct.   It works for me.

yang
Champ in-the-making
Champ in-the-making
Why the message indicates person is indefined ?

thank you

yang
Champ in-the-making
Champ in-the-making
I listed file    Inspect Web Script (org/alfresco/sample/greeting.get) in http://localhost:8080/alfresco/service/sample/greeting
I have add parameter 'Transaction' because in a message is indicate tu write this param with required

Web Script: org/alfresco/sample/greeting.get
Generated from /alfresco/service/script/org/alfresco/sample/greeting.get on 11 sept. 2009 16:51:51

Script Properties
Id:   org/alfresco/sample/greeting.get
Short Name:   Bienvenue
Description:   Formule de politesse
Authentication:   none
Transaction:   required
Method:   GET
URL Template:   /sample/greeting
Format Style:   any
Default Format:   html
Negotiated Formats:   [undefined]
Implementation:   class org.alfresco.web.scripts.DeclarativeWebScript
Extensions:   [undefined]

Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:extensionwebscripts

File: org/alfresco/sample/greeting.get.html.ftl

Hello ${person.properties.userName}

File: org/alfresco/sample/greeting.get.desc.xml

<webscript>
   <shortname>Bienvenue</shortname>
   <description>Formule de politesse</description>
   <url>/sample/greeting</url>
   <authentification>user</authentification>
       <transaction>required</transaction>
</webscript>

Store: workspace://SpacesStore/app:company_home/app:dictionary/cm:webscripts

[No implementation files]

Store: classpath:alfresco/templates/webscripts

[No implementation files]

Store: classpath:alfresco/webscripts

[No implementation files]

thank you