Forums de discussion
Strange behaviour: JSON webservice returns empty
Alex Man, modifié il y a 7 années.
Strange behaviour: JSON webservice returns empty
Junior Member Publications: 70 Date d'inscription: 08/02/16 Publications récentes
I have created a Webservice using service builder which I need return all the employees based on salary hike like High, Medium, Low within a map. My code is as given below
The strange behavior which I have noticed is that when I put a sysout it was displaying all the records within the console, but when I invoke the getEmployees web service under api/jsonws it is returning empty. In my service builder for the employee entity I have given local-service="true" remote-service="true" json-enabled="true"
Am i doing anything wrong.
Can anyone please tell me some solution for this
public Map<string, list<employees>> getEmployees() throws SystemException
{
final Map<string, list<employees>> employees = new HashMap<string, list<employees>>();
final List<employees> highSalary = EmployeesUtil.findByEmployeesBySalaryHike("High");
final List<employees> mediumSalary = EmployeesUtil.findByEmployeesBySalaryHike("Medium");
final List<employees> lowSalary = EmployeesUtil.findByEmployeesBySalaryHike("Low");
employees.put("High", highSalary);
employees.put("Medium", mediumSalary);
employees.put("Low", lowSalary);
System.out.println(employees); // Here it is showing all the values
return employees;
}</employees></employees></employees></string,></string,></string,>
The strange behavior which I have noticed is that when I put a sysout it was displaying all the records within the console, but when I invoke the getEmployees web service under api/jsonws it is returning empty. In my service builder for the employee entity I have given local-service="true" remote-service="true" json-enabled="true"
Am i doing anything wrong.
Can anyone please tell me some solution for this
Amos Fong, modifié il y a 7 années.
RE: Strange behaviour: JSON webservice returns empty
Liferay Legend Publications: 2047 Date d'inscription: 07/10/08 Publications récentes
Hi Alex,
What version of Liferay are you running? I'm not sure, but it may be the return type? Try returning a basic string first to see if that works, then if that's it, I think returning a JSON object should be ok.
What version of Liferay are you running? I'm not sure, but it may be the return type? Try returning a basic string first to see if that works, then if that's it, I think returning a JSON object should be ok.