You need to sign in to do that
Don't have an account?
111
How can return the type(list or map)?
for example
I got the error :
Invalid return type: MAP:String,String |
how can i get the return-value,and the return-value's type is (list or map)?
global class listReturn {
WebService static Map<String,String> listMethod() {
Map<String,String> myList = new Map<String,String>();
myList.put('ID', 'ACOO1');
myList.put('MSG', 'Message');
return myList;
}
}
Superfell
There's no standard serialization for Map, so you can't use that as parameter or return value from a web service.
ckemp
My guess here would be returning the Map or List as the type Object (assuming that every Apex object inherits basic object methods like clone() and toString() from an object called Object - I've never tried this.) When you get the returned object, you can use instanceof() to determine the object type (Map or List) and process it appropriately.