wood burning stoves 2.0*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes is @WebServiceProvider only for JavaSE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "is @WebServiceProvider only for JavaSE" Watch "is @WebServiceProvider only for JavaSE" New topic
Author

is @WebServiceProvider only for JavaSE

khan gul
Ranch Hand

Joined: Jan 27, 2011
Posts: 30
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

Joined: Oct 02, 2008
Posts: 86
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.


Kamal Tripathi
SCJP 1.4 90%, SCWCD5 94%, Next SCDJWS--> In Naescent stage. Researching abt exam and material itself.
khan gul
Ranch Hand

Joined: Jan 27, 2011
Posts: 30
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

Joined: Oct 02, 2008
Posts: 86
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: is @WebServiceProvider only for JavaSE
 
Similar Threads
Difference between @WebService and @WebServiceProvider
Usage of @WebserviceProvider in handling SOAP based webservices
JAX-WS processing large responses
SOAP message with attachment server-side implementation
JAX-WS HTTP Binding