<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Issue with webscript response template in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/issue-with-webscript-response-template/m-p/247156#M200286</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to write some simple webscripts but when I try to use response templates to return some data&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I get a template exception : 05200035 Error during processing of the template Expression "expression" is undefined on line …&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;test.post.json.js&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;function main(){&lt;BR /&gt;model.test = "Hello!";&lt;BR /&gt;}&lt;BR /&gt;main();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;test.post.json.ftl&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;{&lt;BR /&gt;"test" : "${test}"&lt;BR /&gt;}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;test.post.desc.xml&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;webscript&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;shortname&amp;gt;test&amp;lt;/shortname&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;description&amp;gt;test&amp;lt;/description&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;url&amp;gt;/api/test/&amp;lt;/url&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;format default="json"&amp;gt;argument&amp;lt;/format&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;authentication&amp;gt;user&amp;lt;/authentication&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;transaction allow="readwrite"&amp;gt;required&amp;lt;/transaction&amp;gt;&lt;BR /&gt;&amp;lt;/webscript&amp;gt;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Returns a TemplateException: 05200036 Error during processing of the template 'Expression test is undefined on line 2 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in the log.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm calling my scripts using cURL,&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;curl -uadmin:admin -d&amp;nbsp; "" &lt;A href="http://www.alfresco.test/alfresco/s/api/test/" rel="nofollow noopener noreferrer"&gt;http://www.alfresco.test/alfresco/s/api/test/&lt;/A&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jun 2011 09:09:00 GMT</pubDate>
    <dc:creator>abraxas</dc:creator>
    <dc:date>2011-06-20T09:09:00Z</dc:date>
    <item>
      <title>Issue with webscript response template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/issue-with-webscript-response-template/m-p/247156#M200286</link>
      <description>Hello,I'm trying to write some simple webscripts but when I try to use response templates to return some dataI get a template exception : 05200035 Error during processing of the template Expression "expression" is undefined on line …For example:test.post.json.jsfunction main(){model.test = "Hello!";</description>
      <pubDate>Mon, 20 Jun 2011 09:09:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/issue-with-webscript-response-template/m-p/247156#M200286</guid>
      <dc:creator>abraxas</dc:creator>
      <dc:date>2011-06-20T09:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with webscript response template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/issue-with-webscript-response-template/m-p/247157#M200287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You've specified the JavaScript controller as ".post.&lt;/SPAN&gt;&lt;STRONG&gt;json&lt;/STRONG&gt;&lt;SPAN&gt;.js" but this controller will only be used if the request content type is JSON.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i.e you need to add the ""Content-Type: application/json" header to your request.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In general, it's good practice in Freemarker templates to handle potentially missing variables, i.e. &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;${test!""}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2011 09:58:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/issue-with-webscript-response-template/m-p/247157#M200287</guid>
      <dc:creator>mikeh</dc:creator>
      <dc:date>2011-06-20T09:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with webscript response template</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/issue-with-webscript-response-template/m-p/247158#M200288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Mike,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;setting the header solved it. I somehow totally forgot about that&amp;nbsp; &lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://connect.hyland.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;ops:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2011 10:30:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/issue-with-webscript-response-template/m-p/247158#M200288</guid>
      <dc:creator>abraxas</dc:creator>
      <dc:date>2011-06-20T10:30:23Z</dc:date>
    </item>
  </channel>
</rss>

