AnsweredAssumed Answered

Issue with webscript response template

Question asked by abraxas on Jun 20, 2011
Latest reply on Jun 20, 2011 by abraxas
Hello,

I'm trying to write some simple webscripts but when I try to use response templates to return some data
I get a template exception : 05200035 Error during processing of the template Expression "expression" is undefined on line …

For example:
test.post.json.js

function main(){
model.test = "Hello!";
}
main();
test.post.json.ftl
{
"test" : "${test}"
}
test.post.desc.xml
<webscript>
  <shortname>test</shortname>
  <description>test</description>
  <url>/api/test/</url>
  <format default="json">argument</format>
  <authentication>user</authentication>
  <transaction allow="readwrite">required</transaction>
</webscript>

Returns a TemplateException: 05200036 Error during processing of the template 'Expression test is undefined on line 2
in the log.

I'm calling my scripts using cURL,
curl -uadmin:admin -d  "" http://www.alfresco.test/alfresco/s/api/test/

Outcomes