Hi all,

I was wanting to demonstrate to a friend that you can use CXF's jaxrs
client with an existing REST service but ran into a problem that
exists both in CXF and RESTEasy (leading me to believe it is
JSON/Jettison related). I have googled high and low and posted on the
RestEasy list with no solutions, so I'm hoping someone here knows the
solution.

Thew problem comes with a service that returns a JSON packet like the following:

{"name":"James", "activeDate":"<some datestring>", "age":30}

I would expect the following to work

@XmlRootElement
public class Employee{
  private String name;
  private Date activeDate;
  private int age;

  // -- Setters and Getters omitted
}

However it fails because it wants a json packet that looks like this
instead (using the classname)
{"employee":{"name":"James", "activeDate":"<some datestring>", "age":30}}

Is there anyway around this amazingly frustrating issue? I'd really
LOVE to use RestEasy or CXF for the client side due to it's sweet
interface proxying and handling all those low level problems that just
makes things easy but sadly cannot as these existing REST services
that we are integrating with are 3rd party.

Surely someone has encountered this and knows a solution???? :(

Thanks,
James

Reply via email to