Im beginner for Spring Webservices
. Im trying to create contract-first web services using spring-ws 2.0
. I have done web.xml
(MessageDispatcherServlet) configurations, my contract-design (XSD), generated JAXB
classes and service implementations. Im confused in Endpoints. Which one of the following, mvc rest controllers or enpoints, is correct to use in which scenario and why? Thanks in advance.
@Endpoint
public class PersonEndpoint {
@Autowired
private PersonServiceImpl personService;
@PayloadRoot(localPart = "PersonRequest", namespace = Constants.PERSON_NAMESPACE)
public @ResponsePayload
PersonResponseType personReadMethod(@RequestPayload PersonReadRequestType requestElement) {
return personService.isBiometricNeeded(requestElement);
}
}
or
@Controller
public class PersonController {
@Autowired
private PersonServiceImpl personService;
@RequestMapping(value = "/person", method = RequestMethod.GET)
public @ResponseBody
PersonResponseType personReadMethod(@RequestBody PersonReadRequestType requestElement) {
return personService.isBiometricNeeded(requestElement);
}
}