I am trying to transform the response using JS policy. For some of the responses, I am getting the following error. When i debugged , i could see for the responses that get the following error, some values are not present. Hence the corresponding variable in JS is getting populated as "undefined" causing this error. When I comment out that variable, it works fine.
{"fault":{"faultstring":"Execution of BuildGoogleresponse failed with error: Javascript runtime error: \"Access to Java class \"java.lang.Class\" is prohibited. (BuildGoogleresponse_js#62)\"","detail":{"errorcode":"steps.javascript.ScriptExecutionFailed"}}}
Questions:
1)How do i dynamically verify that a value exists for a variable and populate it in the proxy response.
2)Why cant i use a jsonpath like below in the policies.Javascript shows error and if i use it in ExtractVariable policy, I dont see any value getting populated in the variables. This jsonpath works well on website jsonpath.org.
$.photos[?(@.metadata.source.type='PROFILE')].url
I have attached the javascript for your reference.
Regards,
Rajeev S