E4X

jgarnica's picture

Hi everybody. I have a problem in ESB for Filter the next XML using E4X in JS Mediator.

      <datas1:TipoCambioResp xmlns:datas1="http://ws.wso2.org/dataservice">
         <datas1:TipoCambio>
            <datas1:Moneda>UDI</datas1:Moneda>
            <datas1:Fecha>2010-01-28 00:00:00.0</datas1:Fecha>
            <datas1:Valor>4.336054</datas1:Valor>
         </datas1:TipoCambio>
         <datas1:TipoCambio>
            <datas1:Moneda>SMDF</datas1:Moneda>
            <datas1:Fecha>2010-01-21 00:00:00.0</datas1:Fecha>
            <datas1:Valor>1644.000000</datas1:Valor>
         </datas1:TipoCambio>
      </datas1:TipoCambioResp>


I'm trying to get the node Moneda = "UDI".

With this instructions:
*************
var Payload = mc.getPayloadXML();
Payload.*::TipoCambio.(*::Moneda == "UDI")
*************

But I get the next error:
[2010-01-29 18:28:06,880] ERROR - ScriptMediator The script engine returned an error executing the external js script : jsFondeoSEPSTC function InicializaVariables
com.sun.phobos.script.util.ExtendedScriptException: org.mozilla.javascript.EvaluatorException: syntax error (<Unknown source>#44)in: <Unknown source>at line no: 44
        at com.sun.phobos.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:184)
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:62)
        at org.apache.synapse.mediators.bsf.ScriptMediator.prepareExternalScript(ScriptMediator.java:321)
        at org.apache.synapse.mediators.bsf.ScriptMediator.mediateWithExternalScript(ScriptMediator.java:231)
        at org.apache.synapse.mediators.bsf.ScriptMediator.invokeScript(ScriptMediator.java:198)
 

library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)