Hi All,

I believe I have run into a bug in the way that TomEE 1.5+ is handling JSON
when calling a RESTful service.

I have a RESTful service called "UserService".  The class is setup as
follows...

@Path("/rest/userService")
@Produces({"application/json", "text/xml"})
public class UserService {
...

Inside the class I have the following method...

@Path("/getUserInfo")
@POST
public UserInfo getUserInfo(@FormParam("userId") @DefaultValue("0") final
String userId,
...

The getUserInfo method pulls information from the database using JPA and
returns it via the 'UserInfo' DTO.

Everything works great.  The data pulls fine and is correctly inside the
'UserInfo' entity bean.  Notice that I have not set this up to return a List
of UserInfo, but just the UserInfo by itself.

On the client side when the information is returned, since I upgraded to
TomEE 1.5, the JSON looks like this...

{"userInfo":[{"email":"jon...@doesrus.com","firstName":"Jon","langCode":"en","lastName":"Doe","id":7}]}

It is returning the 'UserInfo' with an array, which is incorrect.  It should
look like this...

{"loginMemberInfo":{"email":"jon...@doesrus.com","firstName":"Jon","langCode":"en","lastName":"Doe","id":7}}

The DTO declartion is as follows...

@XmlRootElement
public class UserInfo implements Serializable {
...

Because we have a lot of code that utilizes RESTful in a similar fashion,
this potential bug is obviously causing us big problems. We will have to go
back and change a lot of code if this isn't fixed.

We have tried using a different jettison library, an older one from TomEE
1.0 but that didn't make any difference.

Could someone confirm if this is a bug or if I'm just messing something up
some where?

Thanks for your time!

Kevin



--
View this message in context: 
http://openejb.979440.n4.nabble.com/Possible-JSON-bug-in-TomEE-1-5-and-1-5-1-tp4658328.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to