• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is @WebServiceProvider only for JavaSE

 
khan gul
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am bit confused on when to use @WebServiceProvider annotation? Is it specific to Java SE platform? I have seen many examples online that doesn't use @WebServiceProvider annotation deployed on web server like tomcat.
regards,
gul
 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can point to specific examples, that will help resolve the query faster.

However I think it must work with any java version after 1.5.
 
khan gul
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kamal for the quick reply,
Here is what i am confused about. While reading Java Web Services Up and Running I came across example for restful service using @WebServiceProvider annotation. But online when I look at some of the examples they are not using @WebServiceProvider annotation at all. Have a look at the following code, i have taken it from jersey website http://jersey.java.net/nonav/documentation/latest/user-guide.html#d4e107

1 @Path("/myResource")
2 @Produces("text/plain")
3 public class SomeResource {
4 @GET
5 public String doGetAsPlainText() {
6 ...
7 }
8
9 @GET
10 @Produces("text/html")
11 public String doGetAsHtml() {
12 ...
13 }
14 }

as you can see there is no @WebServiceProvider annotation.

So my understaning is @WebServiceProvider annotation is required only for Java SE and cannot be used in a web container?

Kindly help me understanding under what condition should or shouldn't we use @WebServiceProvider annotaiton.

regards,
gul
 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jersey is one of the frameworks(more specifically, it is called reference implementation) developed on top of JavaSE 1.5 for RESTful web-services. It uses different set of annotations for cleaner coding.

You can use @WebServiceProvider annotation if you are working with Java SE 1.5 directly without jersey RI. However it comes with setting up of entire configuration, properties which you can avoid with Jersey.

Hope this helps. I would suggest to read this relevant chapter from SOA Using Java Webservices from Mark Hansen. It really explains well the concept of JAX-RS and dwells a little into jersey as well with some examples.

Hope it helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic