Hi Sergey, Thanks a lot - the solution was just to use JacksonJaxbJaxrsProvider instead JacksonJsonProvider. No other settings are necessary. JacksonJaxbJaxrsProvider takes JAXB annotations into account.
Regards, Andrei. > -----Original Message----- > From: Sergey Beryozkin [mailto:[email protected]] > Sent: Donnerstag, 11. Februar 2016 14:20 > To: [email protected] > Subject: Re: Uppercase elements in Jackson unmarschaling > > Hi Andriy > > I'm really not sure what can be done with this approach but to try and > investigate how a custom ObjectMapper/etc can be registered with > Jackson*Jaxb*JaxrsProvider. > > Perhaps a longer term strategy for supporting JSON-only services is to start > converting XML schemas into JSON schemas which can be referenced from > for ex Swagger docs ? If we have JSON schemas then we may even consider > updating a wadl2java to convert WADL in JSON to the code too > > Cheers, Sergey > > > > On 11/02/16 12:27, Andrei Shakirin wrote: > > Hi, > > > > I trying to find solution for the following problem: > > > > 1) We have JAX-RS CXF based service, WADL first. The service accepts only > JSON. > > 2) XSD schema has one upper-case element: > > <xs:element name="SKU" type="xs:string"> > > <xs:annotation> > > <xs:appinfo> > > <jaxb:property name="SKU"/> > > </xs:appinfo> > > <xs:documentation>articleID with ebay-suffix > > (articleId_suffix), > case-sensitive</xs:documentation> > > </xs:annotation> > > </xs:element> > > > > The generated JAXB objects contains corresponded @XmlElement > annotation: > > @XmlElement(name = "SKU", namespace = "http://xxx/yyy/", required > = true) > > protected String sku; > > > > 3) Problem: if Jackson tries to unmarshal incoming request, it throws > following exception: > > com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: > > Unrecognized field "SKU" (class xxx.AvailabilityRequestEntry), not > > marked as ignorable (5 known properties: "locationID", > > "requestedQuantity", "trackingUUID", "sku", "fulfillmentType"]) at > > [Source: org.apache.cxf.transport.http.AbstractHTTPDestination > > > > It seems that Jackson doesn't take @XmlElement hint into account. > > I tried to look for solution, the recommendation is using Jackson annotation > @JsonProperty("XXX"): > > http://jackson-users.ning.com/forum/topics/problem-with-upper-case-let > > ter > > http://stackoverflow.com/questions/15303110/jackson-json-field-mapping > > -capitalization > > > > But this is not really acceptable for generated JAXB code. > > > > Is there any elegant solution for such case? > > > > CXF version: 2.7.11 > > Jackson version: 2.7.1 > > > > Regards, > > Andrei.
