mercredi 22 avril 2015

POST using jersey not converting JSON to JAXBObject in REST service

I am writing a POST rest API service , and my service class is

@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response produceJSON(Student student) {

    System.out.println("===============" + student.getFirstName());

    return Response.ok().build();

I am using DEV HTTP Client and sending XML request with complete student object and it is working fine. But when I am sending JSON request with student object , it provides me a student object with all null values. student.getFirstName() is coming as null , though I am setting this value. Any solutions ?

Aucun commentaire:

Enregistrer un commentaire