To return your songs with more attribute, you should create a resource representation class.In your case,it could look like
class Song {
private String name
private String film
//other fields and methods...
Then in your restfull ws
@RequestMapping(value = "/topsongsWS", headers="Accept=application/json")
public List<?> getTopSongsWS()
{
List<Song> l1 = new ArrayList<Song>();
l1.add(new Song(atr1,atr2....));
l1.add(new Song(atr1,atr2....));
l1.add(new Song(atr1,atr2....));
return l1;
}
In your spring mvc app, you should have too the resource representation class, and the response type will now be Song
instead of String
To consume your ws, this should work
@RequestMapping(value="/topsongs",method=RequestMethod.POST)
public String getTopSongs(ModelMap md)
{
String url="http://localhost:7001/SongAppWS/songappWS/topsongsWS";
RestTemplate rt=new RestTemplate();
Song[] songs = template.getForObject(url, Song[].class);
md.addAttribute("listname", "Top 5 Songs of The Week:");
md.addAttribute("res", Arrays.asList(songs));
return "Sucess";
}