AnsweredAssumed Answered

webscript working in Alfresco but not workin in Share

Question asked by xavi_arilos@yahoo.com on Oct 19, 2009
Latest reply on Oct 19, 2009 by mikeh
Hi there,
i am new to the forum and to Alfresco Webscripts. I am workin on an Alfresco share as a support tool for my current project.

My first approach to webscripts is the typical helloworld: http://wiki.alfresco.com/wiki/Web_Scripts_Hello_World_Quick_Start

The result is that the sample webscript is Working in Alfresco, but Failing in Share, I need some help regarding this:

    Caused by: freemarker.core.InvalidReferenceException: Expression person is undefined on line 4, column 42 in hello-world
    /helloworld.get.html.ftl.
            at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
            at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
            at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
            at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
            at freemarker.core.Dot._getAsTemplateModel(Dot.java:74)
            at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
            at freemarker.core.Expression.getStringValue(Expression.java:93)
            at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
            at freemarker.core.Environment.visit(Environment.java:208)
            at freemarker.core.MixedContent.accept(MixedContent.java:92)
            at freemarker.core.Environment.visit(Environment.java:208)
            at freemarker.core.Environment.process(Environment.java:188)
            at freemarker.template.Template.process(Template.java:237)
            at org.alfresco.web.scripts.PresentationTemplateProcessor.process(PresentationTemplateProcessor.java:185)
            … 109 more

This is the webscript:
helloworld.get.desc.xml
    <webscript>
       <shortname>Hello World</shortname>
       <description>Hello World Dashlet</description>
       <family>user-dashlet</family>
       <url>/jaltest/helloworld</url>
       <transaction>required</transaction>
       <authentication>user</authentication>
    </webscript>

helloworld.get.html.ftl
    <div class="dashlet">
    <div class="title">Hello World Title</div>
    <div class="body">
    <span>Hello World Body for : username: ${person.properties.userName}</span>
    </div>
    </div>

To deploy it:
1. Deploy In Alfresco: upload it to Company Home > Data Dictionary > Web Scripts > jal And activate it with the 'refresh web scripts' button in http://alfrescosrvr:8080/alfresco/service/index
2. Deploy In Share: copy it to c:\Alfresco\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\hello-world\ (default installation path of alfresco community on windows xp) And activate it with the 'refresh web scripts' button in http://alfrescosrvr:8080/share/service/index

If I delete the reference to the '${person.properties.userName}' it works correctly in Share. To be sure I am correctly authenticated into share, I paste the webscript URL in the browser after logging in Share.

Thank you very much for your help.

Javier.

Outcomes