Hi,

Even I worked with a script mediator inline script once and faced the same
issue in using toString. removing the toString worked for me too.

regards
Awanthika

On Tue, Mar 24, 2015 at 1:10 PM, Shakila Sivagnanarajah <[email protected]>
wrote:

> Hi,
>
> This is working for me.
> var name=  mc.getPayloadJSON().name;
>
> Thank you
>
> On Tue, Mar 24, 2015 at 12:44 PM, Vanii Thiyagarajah <[email protected]>
> wrote:
>
>> Can you try this?
>> Use property mediator before the script mediator to set a property:
>> property name="JSONPayload" expression="json-eval($.)"
>>
>> On Tue, Mar 24, 2015 at 12:29 PM, Vijayaratha Vijayasingam <
>> [email protected]> wrote:
>>
>>> org.apache.axis2.json.JSONMessage*..
>>>
>>> But synapse * too gave same issue..
>>>
>>> On 24 March 2015 at 12:27, Ishan Jayawardena <[email protected]> wrote:
>>>
>>>> What are the builder and formatter that you have registered?
>>>>
>>>> On Tue, Mar 24, 2015 at 12:17 PM, Vijayaratha Vijayasingam <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi Ishan;
>>>>> I tried following json line[1] in APIM 1..80
>>>>> But im getting following error;
>>>>>
>>>>> My request is a valid json as mentioned below;
>>>>>
>>>>> {
>>>>> "company_uui":"xxx",
>>>>>     "name": "Y"
>>>>> }
>>>>>
>>>>> Why script mediator could not extract 'name' from the incoming json
>>>>> payload?
>>>>>
>>>>> [1]var name=  *mc.getPayloadJSON().name.toString*;
>>>>>
>>>>> [2]
>>>>>
>>>>> 2015-03-24 11:58:40,804] ERROR - ScriptMessageContext JSON object is
>>>>> null.
>>>>>
>>>>> [2015-03-24 11:58:40,806] ERROR - ScriptMediator Error in execution :
>>>>>
>>>>> org.mozilla.javascript.EcmaError: TypeError: Cannot read property
>>>>> "toString" from undefined (eval#2)
>>>>>
>>>>> at
>>>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
>>>>>
>>>>> at
>>>>> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)
>>>>>
>>>>> at
>>>>> org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693)
>>>>>
>>>>> at
>>>>> Thanks.
>>>>> --
>>>>> -Ratha
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Ishan Jayawardena
>>>> Senior Software Engineer
>>>>
>>>
>>>
>>>
>>> --
>>> -Ratha
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>> _______________________________________________
>> Dev mailing list
>> [email protected]
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> 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
>
>


-- 
Awanthika Senarath
Software Engineer, WSO2 Inc.
Mobile: +94717681791
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to