cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ZenEighth <zeneig...@gmail.com>
Subject POST request : List<Object> input through JSON not being recognized
Date Fri, 09 Sep 2011 16:34:43 GMT
Hi,

Using CXF 2.4.2, developing a JAX-RS and JAX-WS combined webservice, which
use the same method.

Am trying to invoke a POST message and would like to pass a List<User>, to
add to the DB. The method looks something like this:
@POST
@Path("/game/{id}/users/")
@WebMethod(operationName = "addUsers")
public Response addUsers(@PathParam("id") @WebParam(name = "id") String id,
List<User> users);

All this method does is get this List, adds this to the DB.

However, I can't seem to make this POST request work while passing JSON
data, as shown below tried both versions below, but I can't get the
List<User> populated, and it throws exception too.
1)
{"User":[{"deleted":"false","id":"1","login":"Test1","name":"Testing1"},{"deleted":"false","id":"2","login":"Test2","name":"Testing2"}]}

2)
{"users":[{"deleted":"false","id":"1","login":"Test1","name":"Testing1"},{"deleted":"false","id":"2","login":"Test2","name":"Testing2"}]}

The User class is pretty simple, just few properties as shown above. 

Let me know if you need any more details on this.

Any help on this is very much appreciated!

--
View this message in context: http://cxf.547215.n5.nabble.com/POST-request-List-Object-input-through-JSON-not-being-recognized-tp4786966p4786966.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Mime
View raw message