Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6666

Permit "unknown" SOAP message header elements and attributes to prevent Unmarshalling Error: unexpected element

    XMLWordPrintableJSON

Details

    Description

      How does one disable the strict validation on the SOAP message header that causes a "Unmarshalling Error: unexpected element" exception when unknown elements and attributes are encountered in the unmarshalling process. (In this case unknown means that elements and attributes are present in the incoming SOAP header but do not exist in the object model.)

      The flow seems to be that ReadHeadersInterceptor creates a DataReader that creates an unmarshaller. The unmarshaller determines whether the custom ValidationEventHandler,
      WSUIDValidationHandler, is set or not. WSUIDValidationHandler is ultimately responsible for throwing the exception.

      There appears to be a couple of ways at least to disable WSUIDValidationHandler in DataReaderImpl:

      1. Set the setEventHandler flag to false.
      2. Ensure the veventHandler field is set to a more lenient custom ValidationEventHandler.

      I cannot determine a way in which to manipulate either of these two fields in DataReaderImpl. Is there a way to do it?

      The setProperty(String prop, Object value) method of DataReaderImpl looks promising because it has lots of logic related to setting the ValidationEventHandler - in particular the set-jaxb-validation-event-handler property seems perfect - but unfortunately this method is not called when unmarshalling the SOAP header part.

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            Chris573 Chris
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: