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-letter 
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.

Reply via email to