Reputation: 258
I am developing in Worklight 5.0.6. I have created an HTTP adapter. On my server side, I have a php script that accepts a parameter from the URL, performs a check on the data using php, and then returns a JSON Object back. When I go to the actual page, It returns data like this:
[{"SUCCESS": "888888888"}]
Now, when I run my HTTP Adapter, I get these results: errors: Class Cast: java.lang.String cannot be cast to org.mozilla.javascript.Scriptable
I've tried to change the returned Content type to text, plain, JSON, json/application and none of those options work. How do I need to return the data from the server so that the HTTP adapter can read it or what changes do I need to make to the HTTP Adapter?
method : 'get',
returnedContentType : 'plain',
path : path,
headers: 'accepts: */*',
parameters : {
'myparam' : param,
}
};
return WL.Server.invokeHttp(input);
Upvotes: 0
Views: 1354
Reputation: 3027
Wrap your json array in an object. Worklight can't handle returning arrays :(
Upvotes: 2