Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-717

Impossible to add custom error handling during JAXB marshalling/unmarshalling.


    • Type: Improvement
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0 GA, 2.0.1, 2.0.2
    • Fix Version/s: 2.0.3
    • Component/s: Core


      Class "org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor" has private access methods "createUnmarshaller(..)" and "createMarshaller(..)" therefore developers (e.g. me) who might need to define custom validation (using "javax.xml.bind.ValidationEventHandler") cannot do it in easy way.

      Usually, developer doesn't need to override default marshalling or unmarshalling validation behavior but the validator has a problem with "XmlGregorianCalendar" unmarshalling, it simply ignores the error (because it is warning for some reason) and it is impossible to get an exception without replacing default validator.

      It would be very good if these methods ("createUnmarshaller(..)" and "createMarshaller(..)") had "protected" access modifier. In this case the methods should accept "JAXBContext" as a parameter instead of "Class<?>" to keep "getJaxbContext(..)" private.

      Another option is adding additional setters for validation handler and many other JAXB options. It seems not so scalable but more strict.


        victor_cr Victor Polischuk created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Fix Version/s 2.0.3 [ 12197 ]
        Assignee Arjen Poutsma [ arjen.poutsma ]
        arjen.poutsma Arjen Poutsma made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        arjen.poutsma Arjen Poutsma made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Resolved [ 5 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


          • Assignee:
            arjen.poutsma Arjen Poutsma
            victor_cr Victor Polischuk
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: