How to validate enum values in CXF/JAXB ?
Issue
- When upgrading from Fuse 6.0 to 6.1.1, CXF / JAXB no longer seems to validate enum values. In Fuse 6, we would see a response similar to:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: cvc-enumeration-valid: Value 'invalidenum' is not facet-valid with respect to enumeration '[valueOne, valueTwo, valueThree, valueFour]'. It must be a value from the enumeration.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
-
In Fuse 6.1.1, the request gets through validation and unmarshals to the underlying JAXB object. It seems that if the enumeration value is invalid, then the element is simply ignored.
-
How can be validate the enum values by default in cxf ?
Environment
- Red Hat JBoss Fuse
- 6.x
- Apache CXF
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.