AnsweredAssumed Answered

Parsing XML response of an external web service in webscript

Question asked by a_kholodkov on Jan 14, 2013
Latest reply on May 29, 2014 by kaynezhang

I`ve been unsuccesfully trying to do a really general thing in Alfresco two days already    :x  - to parse XML-response of an external web service and show it in Share.
I have made a custom page in Share to show result, set up endpoint for the web service, written a web script etc. Everything works fine.

But I cannot parse XML-output of the WS. I can show fully XML-output without parsing, but I want to use only part of the data. So I want to parse it.

I do the next (this is simplified variant).

1). In *.js

var xmlRespTest = "<book><page>1</page><page>2</page><page>3</page></book>"; = xmlRespTest;

2). In *ftl

<#assign dom = data.xmlNodeModel>

Then I have error message:
freemarker.template.TemplateException - Expected hash. data evaluated instead to freemarker.template.SimpleScalar

Can anybody help me? What do I do wrong?

Thanks in advance!