Souce code: https://bitbucket.org/arnavawasthi/apache-cxf-jaxrs-spring/overview
Test case: I want to add multiple customers in one request. So instead of making multiple calls, I want to make one with array of Customer objects. I expected that this array would be easily converted into List<Customer> but it didn't work as expected. URL: http://localhost:8080/jaxrs/jaxrs/customerservice/addCustomersArray/ Accept: application/json Content-Type: application/json Input JSON: {"Customers":{"Customer":[{"id":2999,"name":"Som Awasthi"},{"id":3000,"name":"Arnav Awasthi"}]}} Output: ERROR Accept: application/json Content-Type: application/xml Input XML: <Customers><Customer><id>2999</id><name>Som Awasthi</name></Customer><Customer><id>3000</id><name>Arnav Awasthi</name></Customer></Customers> Output json: {"Customers":{"Customer":[{"id":2999,"name":"Som Awasthi"},{"id":3000,"name":"Arnav Awasthi"}]}} Now since you have the source code, you can try other options as well. Let me know if you get it working. Thanks, Arnav On Sun, May 1, 2011 at 7:13 PM, arnav awasthi <[email protected]>wrote: > If you want, I can share the code and use cases I am trying. > > On Sun, May 1, 2011 at 7:12 PM, Benson Margulies[via CXF] < > [email protected]> wrote: > >> Now we have to wait for Sergey or someone. I'm puzzled by this >> producing that particular error status. >> >> On Sun, May 1, 2011 at 9:39 AM, arnavawasthi <[hidden >> email]<http://user/SendEmail.jtp?type=node&node=4362780&i=0&by-user=t>> >> wrote: >> >> > @Consumes("application/json") was already there. Just to experiment I >> added >> > @Consumes({"application/xml", "application/json"}) and tried with >> equivalent >> > xml instead. With xml it worked. >> > Input XML: >> > <Customers><Customer><id>2999</id><name>Som >> > Awasthi</name></Customer><Customer><id>3000</id><name>Arnav >> > Awasthi</name></Customer></Customers> >> > >> > Output JSON: >> > {"Customer":[{"id":2999,"name":"Som Awasthi"},{"id":3000,"name":"Arnav >> > Awasthi"}]} >> > >> > But if I try the opposite, it doesn't work. May be this error is due to >> the >> > JAXB library, which does not support this feature.-- >> > 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-tp4361669p4362777.html<http://cxf.547215.n5.nabble.com/How-to-submit-JSON-data-as-request-body-in-Apache-CXF-jax-rs-REST-tp4361669p4362777.html?by-user=t> >> >> > Sent from the cxf-user mailing list archive at Nabble.com. >> > >> >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> >> http://cxf.547215.n5.nabble.com/How-to-submit-JSON-data-as-request-body-in-Apache-CXF-jax-rs-REST-tp4361669p4362780.html >> To unsubscribe from How to submit JSON data as request body in Apache CXF >> jax-rs (REST), click >> here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4361669&code=YXJuYXZhd2FzdGhpQGdtYWlsLmNvbXw0MzYxNjY5fC04MTcxNzc0NTY=>. >> >> > > -- 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-tp4361669p4362858.html Sent from the cxf-user mailing list archive at Nabble.com.
