views:

440

answers:

2

Hello,

In a Java method, I'd like to use a Jersey client object to do a POST operation on a RESTful web service (also written using Jersey) but am not sure how to use the client to send the values that will be used as FormParam's on the server. I'm able to send query params just fine.

Thanks in advance.

+1  A: 

Not done this yet myself, but a quick bit of Google-Fu reveals a tech tip on blogs.sun.com with examples of exactly what you ask for.

Example taken from the blog post:

MultivaluedMap formData = new MultivaluedMapImpl();
formData.add("name1", "val1");
formData.add("name2", "val2");
ClientResponse response = webResource.type("application/x-www-form-urlencoded").post(ClientResponse.class, formData);

That any help?

Brabster
Awesome, just what I need. Thanks!
Jon
A: 

Thanks it was very helpful for me

Farshid