tags:

views:

106

answers:

1

Hello All.

I am trying to create a REST web service using JAX-RS. In that, I have PUT method or POST method which consumes the json as mediatype in the REST web service. Can I know how to call these methods from the client side. How do we pass that json as input from client side to those PUT and POST method and how would we consume the json format in the PUT or POST method from server side. If we want to consume xml, then we are using JAXBElement. For consuming json, how to do that ?

A: 

This may help get you going: http://blog.sertik.net/labels/jersey.html

From my (extremely rusty) recollection, you sort of treat the @PUT methods the same way you treat @POST methods. So as shown in that blog entry, try using the @FormParam annotations. Also, read over the Jersey API to see if anything looks useful.

The main difference between them (PUT/POST) is in the meaning; PUT typically creates a new resource at the uri, whereas POST can 'append to' it (there are also a few other meanings to what exactly POST does).

PS almost forgot to mention, cURL is so.... nice.

raeb