This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Services and the fly likes Exposing Methods as RESTFul Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Exposing Methods as RESTFul Services" Watch "Exposing Methods as RESTFul Services" New topic
Author

Exposing Methods as RESTFul Services

Ali Reza Hosseini
Ranch Hand

Joined: Apr 28, 2005
Posts: 33
Hi,

I am having a method which has two parameters in its signature like this:



What I want to do is to make this method available via REST like this:



Is it possible to expose this method as a RESTFul service method although it has more than one entity in its signature?

I ask this because in jersey's api I do not see any way to pass more than one entity to the webResource when calling post()-method.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I am afraid that the subject of your posting - "exposing methods as RESTful services" shows that it would be good to read a little about the concepts behind RESTful web services before trying to implement one.
RESTful web services are not about exposing operations, it is about exposing resources on which you perform a very limited set of operations (usually GET, POST, PUT, DELETE).
Of course you can expose your method as a web service, but it won't be REST. In your case RPC would be a viable option: http://en.wikipedia.org/wiki/Remote_procedure_call

If you want to create a RESTful web service that creates orders, then you can POST the representation of an order, consisting of, among other things, a number of items, to, for instance, http://myserver/resources/orders.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exposing Methods as RESTFul Services