[
https://issues.apache.org/jira/browse/TOMEE-2232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16608069#comment-16608069
]
Romain Manni-Bucau commented on TOMEE-2232:
-------------------------------------------
This is intended, 1.7 and 7.0 use johnzon so use @JohnzonProperty and 7.1 moved
to jsonb so use @JsonbProperty. This kind of worked - it was adding a wrapper -
with 1.5 and previous through jettison but user asked to not keep this bad json
mapping by default so we aligned on the json spec.
> TomEE doesn't honor @XMLElement() name when deserializing JSON
> --------------------------------------------------------------
>
> Key: TOMEE-2232
> URL: https://issues.apache.org/jira/browse/TOMEE-2232
> Project: TomEE
> Issue Type: Bug
> Affects Versions: 7.0.5
> Reporter: Jonathan S Fisher
> Priority: Critical
>
> We encountered a strange limitation while working with salesforce. We're
> hitting their login OAUTH endpoint and it returns a JSON string like this:
> {code:json}
> {
> "access_token":"onebiglongstring",
> "instance_url":"https://ab67.salesforce.com",
> "id":"https://test.salesforce.com/id/sfid/sifd",
> "token_type":"Bearer",
> "issued_at":"1536415016572",
> "signature":"morebase64"
> }
> {code}
> So naturally we constructed the following Java class:
> {code:java}
> @Data
> public class SalesforceLoginToken {
> @XmlElement(name = "access_token")
> private String accessToken;
> @XmlElement(name = "instance_url")
> private String instanceUrl;
> @XmlElement
> private String id;
> @XmlElement(name = "token_type")
> private String tokenType;
> @XmlElement(name = "issued_at")
> private String issuedAt;
> @XmlElement
> private String signature;
> }
> {code}
> However, TomEE will not deserialize any of the fields where the name is
> specified in the XMLElement. A [head-desking] workaround we're using is to
> break javabean convention and write our variables like this:
> {code:java}
> @XmlElement
> private String token_type;
> {code}
> because this won't work. TomEE simply fills out null every time:
> {code:java}
> @XmlElement(name = "token_type")
> private String tokenType;
> {code}
> I believe this used to work in TomEE 1.7.5, I haven't tested on master or
> anything else.
> Anyway thanks,
> -Jonathan
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)