Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-8404

Marshalling and Unmarshalling of Documents (the Document wrapper) is broken when using JAXB or JSON

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 7.21.0.Final
    • 7.20.0.Final
    • KieServer
    • None
    • NEW
    • NEW

      The Documents class, the class we use to store a collection of Document instances, can not be marshalled and unmarshalled with JAXB and JSON over the KIE-Server API (XStream does work). There seem to be multiple problems. The main issue is that Documents contains a List<Document>, where Document is an interface.

      JAXB does not like interfaces, and hence won't marshall and/or unmarshall such an object.

      The problem with JSON is that the JSON Marshaller won't work unless we register Documents and Document as extra remoteable classes. However, KIE-Server does not allow us to register interfaces as Remoteable classes, so this breaks as well.

      What seems to be the solution is to:

      • Add JAXB annotations to the List<Document> attribute of the Documents class. To be specific the annotations:
        @XmlElementWrapper
        @XmlAnyElement(lax=true)
        private List<Document> documents = new ArrayList<>();
        
      • Add the Documents class automatically to the "extraClasses" of the KieContainerInstance.
      • Add the Document interface only to the extra class of the JSONMarshaller (as adding them to the JAXBContext will break JAXB. The idea is to do this via a KIE-Server JSONMarshaller extension.

              swiderski.maciej Maciej Swiderski (Inactive)
              rhn-gps-ddoyle Duncan Doyle (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: