Spring Web Services
  1. Spring Web Services
  2. SWS-657

Provide a way to deal with XSD validation exceptions in POX webservices with marshalling

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0 RC1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Reference: http://stackoverflow.com/questions/4207303/how-to-transform-exceptions-into-return-codes-using-spring-ws

      Spring-WS currently lacks the necessary functionality to be able to deal with exceptions resulting from

      • XSD Validation
      • Malformed XML parsing
        in the case of POX web services where error codes are returned as part of the regular response message instead of relying on faults

      For an endpoint like this:
      @Endpoint
      public class MyEndpoint() {
      private static final String MY_NAMESPACE=...;

      @PayloadRoot(namespace=MY_NAMESPACE, localPart="myPart")
      public MyPartResponse handleMyPart(MyPart myPart)

      { .... }
      }

      Using annotations and marshalling, I would like to propose the following syntax, in the spirit of what spring mvc does with binding errors (which frankly are semantically identical to the case discussed here):

      @Endpoint
      public class MyEndpoint() {
      private static final String MY_NAMESPACE=...;

      @PayloadRoot(namespace=MY_NAMESPACE, localPart="myPart")
      public MyPartResponse handleMyPart(MyPart myPart, Errors errors) { .... }

      }

      When a validation exception occurs (XSD or malformed XML) myPart would then be null and errors would contain the relevant validation error. The method can the construct the response accordingly.

      Cheers,
      Axel

        Activity

        Hide
        Arjen Poutsma added a comment -

        XSD validation errors should be handled in an interceptor, possibly a subclass of AbstractValidatingInterceptor. Introducing an Errors object for this purpose would not fit in the current processing model of Spring-WS.

        Show
        Arjen Poutsma added a comment - XSD validation errors should be handled in an interceptor, possibly a subclass of AbstractValidatingInterceptor. Introducing an Errors object for this purpose would not fit in the current processing model of Spring-WS.

          People

          • Assignee:
            Arjen Poutsma
            Reporter:
            Axel Fontaine
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: