File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help required: Compiling/Deploying a RESTful web service

 
aravind kanganar
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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,

aravind




 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using the Jersey (JSR-311) framework. You certainly do not need an IDE.

You just compile your service class(es) with the annotations and put them where Jersey can find them.

Bill
 
aravind kanganar
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Can I use jax-ws with jersey?

aravind
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Just to clarify one thing:
JAX-WS is an API for creating web services; SOAP or XML, but not RESTful web services. The reference implementation is Metro.
JAX-RS is an API for creating RESTful web services. The reference implementation is Jersey.
Best wishes!
 
Leonardo Carreira
Ranch Hand
Posts: 489
Eclipse IDE Java Postgres Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan for your explanation..
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?..
Thanks in advance..
 
aravind kanganar
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

but check this site :http://java.sun.com/developer/technicalArticles/WebServices/restful/

It's mentioned there that jax-ws gives full support for the RESTful WS development.

Thanks and regards,
aravind
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
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
Best wishes!
 
aravind kanganar
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan!
But can you clarify how jax-rs becomes better for RESTful programming...?
Don't mind I have very less knowledge about these.

-aravind
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
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.
Example: http://my.server.com/resources/customer/12/orders/44
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.
Best wishes!
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
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
Best wishes!
 
aravind kanganar
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic