Thanks, that worked.

But now, if I want to post List of Customers in JSON in the following way:

    @POST
    @Path("/addCustomers/")
    @Consumes(MediaType.APPLICATION_JSON)
    //{"Customer":[{"id":2999,"name":"Som Awasthi"},{"id":3000,"name":"Arnav
Awasthi"}]}
    public List<Customer> addCustomers(List<Customer> list){
        logger.debug(list);
        return list;
    }

Request Header:
Content-Type: application/json

Request Body:
{"Customer":[{"id":2999,"name":"Som Awasthi"},{"id":3000,"name":"Arnav
Awasthi"}]}

Again the "415: Unsupported Media Type" error.

Input to this request is same, what I have got in the listCustomers call,
which is as follows:

    @GET
    @Path("/listCustomers")
    public List<Customer> listCustomers(){
        List<Customer> list = new ArrayList<Customer>();
        list.add(new Customer("Som Awasthi", 2999L));
        list.add(new Customer("Arnav Awasthi", 3000L));
        
        return list;
    }

Regards,
Arnav--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-submit-JSON-data-as-request-body-in-Apache-CXF-jax-rs-REST-tp4361669p4362318.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to