This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
We have built a set of web services. However few of our clients are not able to understand web services. Hence we need to build some wrapper over our web services so that they can send in http request and receive xml responses. I have heard that REST can do something similar. Are their any framework which can help me build some REST services to wrap around my web services?
One of the first tasks in my new job (started two weeks ago) is to create a RESTful web service for the product. So far, using the Jersey reference implementation of JSR133 has been very helpful in getting this up and running quickly.
As usual, the documentation is pretty poor, but even with that (and the fact that they assume that you are using Netbeans and Glassfish, neither of which I use) it's pretty easy to get things working. (The JSR133 Specification is actually a lot more helpful than the Jersey documentation.)
Originally posted by Bear Bibeault: and the fact that they assume that you are using Netbeans and Glassfish, neither of which I use
That's a major gripe of mine lately. NetBeans, GlassFish and Maven are just supposed to be used, when it's rather obvious that many people don't.
I'm still waiting for a packaged binary of Jersey 1.0. Right now the download instructions point to a page full of Maven instructions; anyone not using it needs to hunt down at least 5 jar files on the web site.
I don't understand this: don't they want to make it easy to use? [ October 16, 2008: Message edited by: Ulf Dittmer ]
Author and all-around good cowpoke
Joined: Mar 22, 2000
That's a major gripe of mine lately.
I do not want to be forced into installing and coping with somebody elses' idea of a great programming environment. Keeping up with the enormous number of jar files used is bad enough.
can you send me the procedure to build a simple webservice using REST?
Joined: Mar 22, 2005
Hello "Vinay javaranch"-
On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.
As to your question, everything you need to get started with JAX-RS/Jersey is mentioned in this topic. [ November 14, 2008: Message edited by: Ulf Dittmer ]
Originally posted by vinay ravaranch: can you send me the procedure to build a simple web service using REST?
You have to actually design an actual RESTful web service before you can build it. And Resource-Orientation is different from Object-Orientation.
Restful Web Services is in excellent resource for that. It for example outlines the design steps for a read/write resource: First
Figure out the data set
Split the data set into resources
Then for each resource
Name the resources with URIs
Expose the subset of the uniform interface
Design the representation(s) accepted from the client
Design the representation(s) served to the client
Link the resource to existing Resources (using hypermedia links and forms)
Consider the typical course of events: what's supposed to happen?
Consider error conditions: what might go wrong?
Basically there is precious little that Jersey (JSR-311) can teach you about RESTful web services. You'll have to be well versed in the RESTful principles and practices and you'll need to know and understand the HTTP protocol (HTTP: The Definitive Guide) pretty well, better that most people who build regular web sites. Once you understand all that, you can use Jersey (or RestLet) to implement the RESTful service in Java - either framework does not guarantee that you will create a genuinely RESTful Web service just like Java can't guarantee that you will implement a genuinely Object-Oriented solution. [ November 14, 2008: Message edited by: Peer Reynders ]