I am trying to write and run a RESTful WS.
I have jdk1.5,tomcat 5.5, JAX-WS2.1.7 jar(placed in lib directory of tomcat) and eclipse ganymede ide.
I wrote a sample AddNumbers service (got it from a web tutor) using elipse.I also created web.xml , sun-jaxws.xml and AddNums.wsdl and placed them all in WEB-INF directory of my project as directed in that tutorial.
Now the questions are:
The web.xml mentions a servlet "restful-addnumbers" , should it
be written by programmer or is it auto generated?
Do I need to use any other library or tool?
If I am going to write and deploy RESTful WS without an IDE, how to do so?
waiting for answers,
You just compile your service class(es) with the annotations and put them where Jersey can find them.
Well, if you want to be strict, you can implement a RESTful web service using socket streams.
Yes, you can do it with JAX-WS, but it feels slightly awkward to me when compared to using JAX-RS. An example can be found here: http://netbeans.org/kb/docs/websvc/rest.html
Leonardo Carreira wrote:Which one between JAX-WS and JAX-RS that often used for developing Web Service?..
and what is the differences between JAX-WS and JAX-RS?
The answer is: It depends.
It depends on what you want to do and, sometimes, it also depends on who you ask.
Here are some things that come to me in the spur of the moment:
Characteristics of RESTful web services are:
- Performs operations using a limited set of verbs (typically GET, PUT, POST, DELETE) on resources.
- Retrieves a representation of a resource using the JSON or XML data format.
- Uses URLs to address resources.
This URL would retrieve the customer 12's order 44.
- Always (?) uses HTTP transport.
Characteristics of SOAP web services:
- More choices; different transports (HTTP, JMS, TCP, you could even use mail), security (signature, encryption both whole and partial), can have attachments, can be compressed etc etc.
- With more choices also follows the chance of increased complexity.
- Interface and datatypes described by WSDL document.
- Uses operation names to address functionality.
My advice is: Play around with both RESTful and SOAP web services and get to know them. This way you will increase your chances of making the correct choice when you are to choose which one to use.
aravind kanganar wrote:
But can you clarify how jax-rs becomes better for RESTful programming...?
Others have already said it much better than I am able to.
Take a look at this presentation of JAX-RS: http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features