Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exposing Methods as RESTFul Services

 
Ali Reza Hosseini
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic