Hi, I'm using a script mediator to get JSON payload inside an API sequence. I'm using a payload as follows.
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/xml' --header 'Authorization: Bearer c4f97c6e-60fc-3c26-97ad-48b9c9fa4566' -d '{ \ "PhoneNumbers": ["123456789"] \ }' 'https://10.100.7.133:8243/phoneVerify/1.0.0/checkPhoneNumbers I'm accessing the payload inside the script mediator as follows. <script language="js"> var payload = mc.getPayloadJSON(); </script> There I get following exception at the script mediator on the json payload being null. [2018-01-09 20:37:55,454] ERROR - ScriptMessageContext JSON object is null. [2018-01-09 20:37:55,458] ERROR - ScriptMediator The script engine returned an error executing the inlined js script function mediate but I have looked into the wirelogs and the json message comes to the sequence. [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6 >> "Accept-Language: en-US,en;q=0.9,nl;q=0.8[\r][\n]" [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6 >> "[\r][\n]" [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6 >> "{[\n]" [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6 >> " *"PhoneNumbers": ["123456789"][\n]"* [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6 >> "}" What could be the reason for this? Any other suggestions to access message context inside a script mediator. Thanks and Regards, Sameera. -- Sameera Gunarathne Software Engineer, WSO2 Inc. http://wso2.com <http://l.facebook.com/l.php?u=http%3A%2F%2Fwso2.com&h=gAQEswASa> Email: samee...@wso2.com Mobile: +94714155561
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev