Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

is @WebServiceProvider only for JavaSE

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic