We would like to create a \"WebService\" which return a list of specific objects. And we would like to call this webservice from another java program by apache http clients libr
Actually you have to use REST web service that carry JSON/XML format as Objects representation. I prefer JSON because this is very light weight.
First you need to add dependency in your Pom.xml
org.codehaus.jackson
jackson-mapper-asl
1.7.1
and your method handler is here
@ResponseBody
@RequestMapping(value = "/your URL")
public ArrayList getInboxPage(@RequestParam int var,HttpSession session) {
ArrayList fooList=new ArrayList();
fooList.add(1L);
fooList.add(2L);
fooList.add(3L);
return fooList;
}
NOTE: Spring automatically make JSON if you write @ResponseBody annotation in your method handler you don't need to add Jackson dependency in your pom.xml file.