Hi,

Same is mentioned in [1]

Can be resolved once following is merged in given order. This will be fixed
in 4.9.0 M5.

1 https://github.com/wso2/orbit/pull/45
2 https://github.com/wso2-dev/carbon-mediation/pull/92

[1] https://wso2.org/jira/browse/ESBJAVA-3456

On Tue, Dec 23, 2014 at 5:04 PM, Shakila Sivagnanarajah <[email protected]>
wrote:

> Hi all,
>
> I am developing ESB connector. In which, I am using script mediator. ESB
> 4.9.0 does not works properly for script mediator. The configuration [1]
> and the chunk of corresponding log [2] is given below. The connector
> should be completely tested with ESB 4.9.0 to put in to the connector
> store. This is a blocker for me.
>
> [1]
> <template name="setTargetTemperature" xmlns="
> http://ws.apache.org/ns/synapse";>
>     <parameter name="targetTemperature" description="Value of target
> temperature."/>
>     <parameter name="scale" description="Temperature scale of the target
> temperature."/>
>     <parameter name="deviceId" description="Id of the thermostat device."/>
>     <sequence>
>         <property name="uri.var.targetTemperature"
> expression="$func:targetTemperature"/>
>         <property name="uri.var.scale" expression="$func:scale"/>
>         <property name="uri.var.deviceId" expression="$func:deviceId"/>
>         <payloadFactory media-type="json">
>             <format>
>                 <request xmlns="" method="setTargetTemperature">
>                 </request>
>             </format>
>         </payloadFactory>
>         <script language="js">
>             <![CDATA[
>                    //request body param variables
>                     var targetTemperature =
> mc.getProperty('uri.var.targetTemperature');
>                     var scale = mc.getProperty('uri.var.scale');
>                    //Get the existing payload
>                     var payload = mc.getPayloadJSON();
>                     if (scale.toLowerCase() == "f") {
>                         payload.target_temperature_f = targetTemperature;
>                     }
>                     if (scale.toLowerCase() == "c") {
>                         payload.target_temperature_c = targetTemperature;
>                     }
>                    //Set the newly constructed payload
>                     mc.setPayloadJSON(payload);
>             ]]>
>         </script>
>         <property name="Content-Type" value="application/json"
> scope="transport"/>
>         <call>
>             <endpoint>
>                 <http method="put"
>
> uri-template="{uri.var.apiUrl}/devices/thermostats/{uri.var.deviceId}?auth={uri.var.accessToken}"/>
>             </endpoint>
>         </call>
>     </sequence>
> </template>
>
> [2]
> [2014-12-23 16:49:23,805]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler} -
> Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "JSON" is not
> defined. (<Unknown source>#1)
> [2014-12-23 16:49:23,807]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
> [2014-12-23 16:49:23,808]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
> [2014-12-23 16:49:23,808]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at
> org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413)
> [2014-12-23 16:49:23,808]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at org.mozilla.javascript.ScriptRuntime.name
> (ScriptRuntime.java:1612)
> [2014-12-23 16:49:23,808]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at org.mozilla.javascript.gen.c8._c0(<Unknown source>:1)
> [2014-12-23 16:49:23,809]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at org.mozilla.javascript.gen.c8.call(<Unknown source>)
> [2014-12-23 16:49:23,809]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
> [2014-12-23 16:49:23,809]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
> [2014-12-23 16:49:23,809]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at org.mozilla.javascript.gen.c8.call(<Unknown source>)
> [2014-12-23 16:49:23,809]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at org.mozilla.javascript.gen.c8.exec(<Unknown source>)
> [2014-12-23 16:49:23,809]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at
> org.mozilla.javascript.Context.evaluateReader(Context.java:1227)
> [2014-12-23 16:49:23,810]  INFO
> {org.wso2.carbon.automation.core.utils.coreutils.InputStreamHandler}
> -          at
> com.sun.phobos.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:172)
>
> Thank you.
> --
> Shakila Sivagnanarajah
> Associate Software Engineer
> Mobile :+94 (0) 770 760240
> [email protected]
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 

Best Regards,

Malaka Silva
Senior Tech Lead
M: +94 777 219 791
Tel : 94 11 214 5345
Fax :94 11 2145300
Skype : malaka.sampath.silva
LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
Blog : http://mrmalakasilva.blogspot.com/

WSO2, Inc.
lean . enterprise . middleware
http://www.wso2.com/
http://www.wso2.com/about/team/malaka-silva/
<http://wso2.com/about/team/malaka-silva/>

Save a tree -Conserve nature & Save the world for your future. Print this
email only if it is absolutely necessary.
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to