[prev in list] [next in list] [prev in thread] [next in thread]
List: wsf-javascript-dev
Subject: Re: [Dev] Unable to read content from WSRequest.responseE4X
From: Jayanga Dissanayake <jayanga () wso2 ! com>
Date: 2014-04-30 12:53:23
Message-ID: CAKkpS5yA9ZouNwdo7Q3W3CjN4w74nxkwS7QSoO4e-ER2QvcVDw () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi Nadeesha,
Thanks for the reply. I checked the type of the object, its an XML object.
There was a bug in the code which I originally posted. Then I fixed [1]. It
solve the syntax error. but it failed in execution [2]
[1]
log.info(responseMessage.ns::commandResponse.ns::return.toString());
[2]
js: "/operation_center/api/action/control_command.jag", line 44: missing
name after :: operator
js: log.info
(responseMessage.ns::commandResponse.ns::return.toString());
js: ...............................................................^
[2014-04-30 17:55:25,943] ERROR
{org.jaggeryjs.scriptengine.engine.RhinoEngine} -
org.jaggeryjs.scriptengine.exceptions.ScriptException:
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax
errors. (/operation_center/api/action/control_command.jag#1)
[2014-04-30 17:55:25,943] ERROR
{org.jaggeryjs.jaggery.core.manager.WebAppManager} -
org.jaggeryjs.scriptengine.exceptions.ScriptException:
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax
errors. (/operation_center/api/action/control_command.jag#1)
org.jaggeryjs.scriptengine.exceptions.ScriptException:
org.jaggeryjs.scriptengine.exceptions.ScriptException:
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax
errors. (/operation_center/api/action/control_command.jag#1)
Regards,
Jayanga.
*Jayanga Dissanayake*
Senior Software Engineer
WSO2 Inc. - http://wso2.com/
lean . enterprise . middleware
email: jayanga@wso2.com
mobile: +94772207259
On Wed, Apr 30, 2014 at 5:33 PM, Nadeesha Cabral <nadeeshac@wso2.com> wrote:
> Hello Jayanga,
>
> On Wed, Apr 30, 2014 at 2:25 PM, Jayanga Dissanayake <jayanga@wso2.com>
> wrote:
>
> exceptions.ScriptException: org.mozilla.javascript.EvaluatorException:
> > Compilation produced 1 syntax errors.
>
>
> This is a syntax error. I'm assuming responseMessage a bunch of XML. XML
> will be treated as a string in this context. Hence, you can't traverse it
> with these operators. You'll have to parse it to be a Javascript object.
>
> Have you tried parsing it with XML utility for jaggery [1]?
>
> [1] http://jaggeryjs.org/documentation.jag?api=xml
>
> Cheers,
> Nadeesha.
>
>
> On Wed, Apr 30, 2014 at 2:25 PM, Jayanga Dissanayake <jayanga@wso2.com>wrote:
>
> > Hi All,
> >
> > I was trying to get the response from WSRequest as a responseE4X. This
> > returns the actual response received [1]. But the contents of the response
> > cannot be accessed [2].
> >
> > [1]
> >
> > <ns:commandResponse xmlns:ns="http://org.wso2.carbon.oc.services/agent">
> >
> > <ns:return>{"ocMessageName":"CommandMessageResponse","ocaToken":"e9f73475-34ad-494 \
> > b-83be-ccb415176efb","command":"restartGracefully","status":"RESTARTING"}</ns:return>
> > </ns:commandResponse>
> >
> > [2]
> >
> > 2014-04-30 14:24:13,241] INFO {JAGGERY.api.update:jag} - Updating...
> > js: "/operation_center/api/action/control_command.jag", line 43: missing
> > ) after argument list
> > js: log.info
> > (responseMessage.ns:commandResponse.ns:return.toString());
> > js: ................................^
> > [2014-04-30 14:24:15,545] ERROR
> > {org.jaggeryjs.scriptengine.engine.RhinoEngine} -
> > org.jaggeryjs.scriptengine.exceptions.ScriptException:
> > org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax
> > errors. (/operation_center/api/action/control_command.jag#1)
> > [2014-04-30 14:24:15,545] ERROR
> > {org.jaggeryjs.jaggery.core.manager.WebAppManager} -
> > org.jaggeryjs.scriptengine.exceptions.ScriptException:
> > org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax
> > errors. (/operation_center/api/action/control_command.jag#1)
> > org.jaggeryjs.scriptengine.exceptions.ScriptException:
> > org.jaggeryjs.scriptengine.exceptions.ScriptException:
> > org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax
> > errors. (/operation_center/api/action/control_command.jag#1)
> >
> >
> > Regards,
> > *Jayanga Dissanayake*
> > Senior Software Engineer
> > WSO2 Inc. - http://wso2.com/
> > lean . enterprise . middleware
> > email: jayanga@wso2.com
> > mobile: +94772207259
> >
> > _______________________________________________
> > Dev mailing list
> > Dev@wso2.org
> > http://wso2.org/cgi-bin/mailman/listinfo/dev
> >
> >
>
>
> --
> Nadeesha
> @ncthis
> 0779094280
>
[Attachment #5 (text/html)]
<div dir="ltr"><div><div><div>Hi Nadeesha,<br><br>Thanks for the reply. I checked the \
type of the object, its an XML object.<br></div>There was a bug in the code which I \
originally posted. Then I fixed [1]. It solve the syntax error. but it failed in \
execution [2]<br> <br>[1] <br><br><a \
href="http://log.info">log.info</a>(responseMessage.ns::commandResponse.ns::return.toString());<br><br>[2]<br><br>js: \
"/operation_center/api/action/control_command.jag", line 44: missing name \
after :: operator<br>
js: <a \
href="http://log.info">log.info</a>(responseMessage.ns::commandResponse.ns::return.toString());<br>js: \
...............................................................^<br>[2014-04-30 \
17:55:25,943] ERROR {org.jaggeryjs.scriptengine.engine.RhinoEngine} - \
org.jaggeryjs.scriptengine.exceptions.ScriptException: \
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax errors. \
(/operation_center/api/action/control_command.jag#1)<br> [2014-04-30 17:55:25,943] \
ERROR {org.jaggeryjs.jaggery.core.manager.WebAppManager} - \
org.jaggeryjs.scriptengine.exceptions.ScriptException: \
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax errors. \
(/operation_center/api/action/control_command.jag#1)<br>
org.jaggeryjs.scriptengine.exceptions.ScriptException: \
org.jaggeryjs.scriptengine.exceptions.ScriptException: \
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax errors. \
(/operation_center/api/action/control_command.jag#1)<br> \
<br></div>Regards,<br></div>Jayanga.<br></div><div class="gmail_extra"><br \
clear="all"><div><div dir="ltr"><font><span style="color:rgb(102,102,102)"><b>Jayanga \
Dissanayake</b></span></font><br><font size="1"><span \
style="color:rgb(153,153,153)">Senior Software Engineer<br> WSO2 Inc. - <a \
href="http://wso2.com/" target="_blank">http://wso2.com/</a><br>lean . enterprise . \
middleware<br>email: <a href="mailto:jayanga@wso2.com" \
target="_blank">jayanga@wso2.com</a><br>mobile: +94772207259</span></font><br> \
</div></div> <br><br><div class="gmail_quote">On Wed, Apr 30, 2014 at 5:33 PM, \
Nadeesha Cabral <span dir="ltr"><<a href="mailto:nadeeshac@wso2.com" \
target="_blank">nadeeshac@wso2.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> <div dir="ltr"><div class="gmail_extra"><div \
class="gmail_extra">Hello Jayanga,</div><div><br></div><div class="gmail_quote">On \
Wed, Apr 30, 2014 at 2:25 PM, Jayanga Dissanayake <span dir="ltr"><<a \
href="mailto:jayanga@wso2.com" target="_blank">jayanga@wso2.com</a>></span> \
wrote:<div class=""> <br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">exceptions.ScriptException: \
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax \
errors.</blockquote>
</div></div><br></div><div class="gmail_extra">This is a syntax error. I'm \
assuming <span style="font-family:arial,sans-serif;font-size:13px">responseMessage a \
bunch of XML. XML will be treated as a string in this context. Hence, you can't \
traverse it with these operators. You'll have to parse it to be a Javascript \
object.</span></div>
<div class="gmail_extra"><span \
style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div \
class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px">Have \
you tried parsing it with XML utility for jaggery</span><span \
style="font-family:arial,sans-serif;font-size:13px"> </span><span \
style="font-family:arial,sans-serif;font-size:13px">[1]</span><span \
style="font-family:arial,sans-serif;font-size:13px">?</span></div>
<div class="gmail_extra"><font face="arial, sans-serif"><br></font></div><div \
class="gmail_extra"><font face="arial, sans-serif">[1] <a \
href="http://jaggeryjs.org/documentation.jag?api=xml" \
target="_blank">http://jaggeryjs.org/documentation.jag?api=xml</a><br>
</font><br>Cheers,</div><div class="gmail_extra">Nadeesha.</div></div><div \
class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Wed, Apr \
30, 2014 at 2:25 PM, Jayanga Dissanayake <span dir="ltr"><<a \
href="mailto:jayanga@wso2.com" target="_blank">jayanga@wso2.com</a>></span> \
wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi \
All,<br><br></div><div>I was trying to get the response from WSRequest as a \
responseE4X. This returns the actual response received [1]. But the contents of the \
response cannot be accessed [2].<br>
<br>
[1] <br><br><ns:commandResponse xmlns:ns="<a \
href="http://org.wso2.carbon.oc.services/agent" \
target="_blank">http://org.wso2.carbon.oc.services/agent</a>"><br> \
<ns:return>{"ocMessageName":"CommandMessageResponse","o \
caToken":"e9f73475-34ad-494b-83be-ccb415176efb","command":&qu \
ot;restartGracefully","status":"RESTARTING"}</ns:return><br>
</ns:commandResponse><br><br>[2] <br><br>2014-04-30 14:24:13,241] INFO \
{JAGGERY.api.update:jag} - Updating...<br>js: \
"/operation_center/api/action/control_command.jag", line 43: missing ) \
after argument list<br>
js: <a href="http://log.info" \
target="_blank">log.info</a>(responseMessage.ns:commandResponse.ns:return.toString());<br>js: \
................................^<br>[2014-04-30 14:24:15,545] ERROR \
{org.jaggeryjs.scriptengine.engine.RhinoEngine} - \
org.jaggeryjs.scriptengine.exceptions.ScriptException: \
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax errors. \
(/operation_center/api/action/control_command.jag#1)<br>
[2014-04-30 14:24:15,545] ERROR {org.jaggeryjs.jaggery.core.manager.WebAppManager} - \
org.jaggeryjs.scriptengine.exceptions.ScriptException: \
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax errors. \
(/operation_center/api/action/control_command.jag#1)<br>
org.jaggeryjs.scriptengine.exceptions.ScriptException: \
org.jaggeryjs.scriptengine.exceptions.ScriptException: \
org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax errors. \
(/operation_center/api/action/control_command.jag#1)<br>
<br></div><div><br></div>Regards,<br clear="all"><div><div><div><div \
dir="ltr"><font><span style="color:rgb(102,102,102)"><b>Jayanga \
Dissanayake</b></span></font><br><font size="1"><span \
style="color:rgb(153,153,153)">Senior Software Engineer<br>
WSO2 Inc. - <a href="http://wso2.com/" target="_blank">http://wso2.com/</a><br>lean . \
enterprise . middleware<br>email: <a href="mailto:jayanga@wso2.com" \
target="_blank">jayanga@wso2.com</a><br>mobile: <a href="tel:%2B94772207259" \
value="+94772207259" target="_blank">+94772207259</a></span></font><br>
</div></div>
</div></div></div>
<br></div></div>_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@wso2.org" target="_blank">Dev@wso2.org</a><br>
<a href="http://wso2.org/cgi-bin/mailman/listinfo/dev" \
target="_blank">http://wso2.org/cgi-bin/mailman/listinfo/dev</a><br> \
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br \
clear="all"><div><br></div>-- <br><div \
dir="ltr">Nadeesha<div>@ncthis</div><div>0779094280</div></div> </font></span></div>
</blockquote></div><br></div>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic