Re: POST request : List input through JSON not being recognized

Sat, 10 Sep 2011 10:52:36 -0700

Hi
redirecting to the users list...

What exception is thrown ? May be it should be "{"Users":"", note capital 'U'

cheers, Sergey
On 09/09/11 17:34, ZenEighth wrote:
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.

Reply via email to