I am trying to validate incoming SOAP messages annotated with XJsr303Annotations. Validation works when i apply this technique on Spring controllers, however i cannot make it work for endpoints. Here is my setup. There is a number of questions regarding this issue, but i haven't seen any with this approach.
@PayloadRoot(namespace = NAMESPACE_URI, localPart = SERVICE_NAME)
@ResponsePayload
public Response doStuff(@Valid @RequestPayload Request request) {
// doing something
Request is annotated with not null for mandatory parameters, and so on.
Exception handler for invalid requests:
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseBody
public Response handleInvalidRequest(MethodArgumentNotValidException e) {
// return Respone
I have added following dependencies in pom file:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.1.Final</version>
</dependency>
Shouldn't this also work for the SOAP messages, like it does for REST requests on the Controllers? When i send request with all mandatory parameters missing it isn't picked up by this exception handler.
Aucun commentaire:
Enregistrer un commentaire