I'm trying to invoke a spring web service, using below url in browser the service "myservice" should return XML, ie based on the @RequestMapping annotations is the below URL correct?
> http://localhost:8080/mywebapp/myservice/feeds/allFeeds.xml/
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@RequestMapping("myservice")
public class TheController {
private TheService TheServiceWS;
public TheController(TheService TheServiceWS) {
this.TheServiceWS = TheServiceWS;
}
@RequestMapping(value = "feeds/allFeeds.xml", produces = MediaType.APPLICATION_XML_VALUE)
@ResponseBody
public String getValues() {
return TheServiceWS.getAllFeeds();
}
}
The problem for me was :
The @RequestMapping annotation value "myservice" was incorrect
should have been "mywebservice"