Re: [Dev] Script mediator issue in ESB 4.9.0

2015-01-04 Thread Naasheer Ali
Hi Vanji,
  Thanks and Noted.

Regards,
-- 

*Naasheer Ali* | Associate Software Engineer

WSO2, Inc |#20, Palm Grove, Colombo 03, Sri Lanka

Email: naashe...@wso2.com

On Mon, Jan 5, 2015 at 12:27 PM, Vanjikumaran Sivajothy va...@wso2.com
wrote:

 Hi Naasheer,

 As malaka informed this is known issue in the M4. However we have the fix
 for this issue and it will be released in M5.


 Thanks
 Vanji

 On Mon, Jan 5, 2015 at 12:25 PM, Naasheer Ali naashe...@wso2.com wrote:

 Hi,
   I'm developing YouTube connector for ESB. I used ESB 4.9.0 M4 Pack to
 test testcases but, M4 Pack does not work properly for script mediator. I'm
 getting the same error like shakila's. My coding is properly working on ESB
 4.8.1. This is a blocker to me to test with ESB 4.9.0 M4 Pack.

 Regards,
 --

 *Naasheer Ali* | Associate Software Engineer

 WSO2, Inc |#20, Palm Grove, Colombo 03, Sri Lanka

 Email: naashe...@wso2.com

 On Tue, Dec 23, 2014 at 6:20 PM, Vanjikumaran Sivajothy va...@wso2.com
 wrote:

 Hi Sameera,
 Is it possible to merge the given pull request for orbit.

 Thanks
 Vanji


 On Tuesday, December 23, 2014, Malaka Silva mal...@wso2.com wrote:

 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 
 shak...@wso2.com 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 

Re: [Dev] Script mediator issue in ESB 4.9.0

2015-01-04 Thread Sameera Jayasoma
We cannot modify already released orbit bundle pom.xml file. We have to
release a new version then.

On Mon, Jan 5, 2015 at 12:41 PM, Malaka Silva mal...@wso2.com wrote:

 Hi Sameera,

 No this was already there.

 On Mon, Jan 5, 2015 at 12:37 PM, Sameera Jayasoma same...@wso2.com
 wrote:

 Hi Vanji,

 Is this a new Orbit bundle?

 Thanks,
 Sameera.

 On Tue, Dec 23, 2014 at 6:20 PM, Vanjikumaran Sivajothy va...@wso2.com
 wrote:

 Hi Sameera,
 Is it possible to merge the given pull request for orbit.

 Thanks
 Vanji


 On Tuesday, December 23, 2014, Malaka Silva mal...@wso2.com wrote:

 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 
 shak...@wso2.com 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 

Re: [Dev] Script mediator issue in ESB 4.9.0

2015-01-04 Thread Vanjikumaran Sivajothy
Nope it is the old one. But malaka has added the correct parent details.

On Mon, Jan 5, 2015 at 12:37 PM, Sameera Jayasoma same...@wso2.com wrote:

 Hi Vanji,

 Is this a new Orbit bundle?

 Thanks,
 Sameera.

 On Tue, Dec 23, 2014 at 6:20 PM, Vanjikumaran Sivajothy va...@wso2.com
 wrote:

 Hi Sameera,
 Is it possible to merge the given pull request for orbit.

 Thanks
 Vanji


 On Tuesday, December 23, 2014, Malaka Silva mal...@wso2.com wrote:

 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 
 shak...@wso2.com 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 

Re: [Dev] Script mediator issue in ESB 4.9.0

2015-01-04 Thread Malaka Silva
Hi Sameera,

No this was already there.

On Mon, Jan 5, 2015 at 12:37 PM, Sameera Jayasoma same...@wso2.com wrote:

 Hi Vanji,

 Is this a new Orbit bundle?

 Thanks,
 Sameera.

 On Tue, Dec 23, 2014 at 6:20 PM, Vanjikumaran Sivajothy va...@wso2.com
 wrote:

 Hi Sameera,
 Is it possible to merge the given pull request for orbit.

 Thanks
 Vanji


 On Tuesday, December 23, 2014, Malaka Silva mal...@wso2.com wrote:

 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 
 shak...@wso2.com 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 

Re: [Dev] Script mediator issue in ESB 4.9.0

2015-01-04 Thread Naasheer Ali
Hi,
  I'm developing YouTube connector for ESB. I used ESB 4.9.0 M4 Pack to
test testcases but, M4 Pack does not work properly for script mediator. I'm
getting the same error like shakila's. My coding is properly working on ESB
4.8.1. This is a blocker to me to test with ESB 4.9.0 M4 Pack.

Regards,
-- 

*Naasheer Ali* | Associate Software Engineer

WSO2, Inc |#20, Palm Grove, Colombo 03, Sri Lanka

Email: naashe...@wso2.com

On Tue, Dec 23, 2014 at 6:20 PM, Vanjikumaran Sivajothy va...@wso2.com
wrote:

 Hi Sameera,
 Is it possible to merge the given pull request for orbit.

 Thanks
 Vanji


 On Tuesday, December 23, 2014, Malaka Silva mal...@wso2.com wrote:

 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 shak...@wso2.com
  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
 

Re: [Dev] Script mediator issue in ESB 4.9.0

2015-01-04 Thread Vanjikumaran Sivajothy
Hi Naasheer,

As malaka informed this is known issue in the M4. However we have the fix
for this issue and it will be released in M5.


Thanks
Vanji

On Mon, Jan 5, 2015 at 12:25 PM, Naasheer Ali naashe...@wso2.com wrote:

 Hi,
   I'm developing YouTube connector for ESB. I used ESB 4.9.0 M4 Pack to
 test testcases but, M4 Pack does not work properly for script mediator. I'm
 getting the same error like shakila's. My coding is properly working on ESB
 4.8.1. This is a blocker to me to test with ESB 4.9.0 M4 Pack.

 Regards,
 --

 *Naasheer Ali* | Associate Software Engineer

 WSO2, Inc |#20, Palm Grove, Colombo 03, Sri Lanka

 Email: naashe...@wso2.com

 On Tue, Dec 23, 2014 at 6:20 PM, Vanjikumaran Sivajothy va...@wso2.com
 wrote:

 Hi Sameera,
 Is it possible to merge the given pull request for orbit.

 Thanks
 Vanji


 On Tuesday, December 23, 2014, Malaka Silva mal...@wso2.com wrote:

 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 
 shak...@wso2.com 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
 

Re: [Dev] Script mediator issue in ESB 4.9.0

2015-01-04 Thread Sameera Jayasoma
Hi Vanji,

Is this a new Orbit bundle?

Thanks,
Sameera.

On Tue, Dec 23, 2014 at 6:20 PM, Vanjikumaran Sivajothy va...@wso2.com
wrote:

 Hi Sameera,
 Is it possible to merge the given pull request for orbit.

 Thanks
 Vanji


 On Tuesday, December 23, 2014, Malaka Silva mal...@wso2.com wrote:

 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 shak...@wso2.com
  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}
 -  

[Dev] Script mediator issue in ESB 4.9.0

2014-12-23 Thread Shakila Sivagnanarajah
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
shak...@wso2.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Script mediator issue in ESB 4.9.0

2014-12-23 Thread Malaka Silva
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 shak...@wso2.com
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 

Re: [Dev] Script mediator issue in ESB 4.9.0

2014-12-23 Thread Vanjikumaran Sivajothy
Hi Sameera,
Is it possible to merge the given pull request for orbit.

Thanks
Vanji

On Tuesday, December 23, 2014, Malaka Silva mal...@wso2.com wrote:

 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 shak...@wso2.com
 javascript:_e(%7B%7D,'cvml','shak...@wso2.com'); 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]