my dog learned polymorphism*
The moose likes Web Services and the fly likes Difference between @WebService and @WebServiceProvider Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Difference between @WebService and @WebServiceProvider" Watch "Difference between @WebService and @WebServiceProvider" New topic

Difference between @WebService and @WebServiceProvider

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228

What is the difference between @WebService annotation and @WebServiceProvider annotation.

C Shinde
Ranch Hand

Joined: Oct 22, 2009
Posts: 60
Hello Saathvik,

Did you get to know what is the difference between the two?
When do you use 1 over the other?

Chetan Shinde

Chetan Shinde
C Shinde
Ranch Hand

Joined: Oct 22, 2009
Posts: 60
Well I found the answer for it on another post,the webservice certification


But then I had a question, a basic if I am marking a method as @WebService and have multiple methods defined in it, how do I send request to different methods in this @WebService? Ok, the endpoint address that is defined is for the entire class, and as long as the class has the methods marked as WebMethods, with the exclude attribute absent it can be accessed as a normal class method in the client.

Hope my understanding is right.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
If you annotate an endpoint implementation class with @WebService, then operations will be generated for all the public methods that are not annotated with a @WebMethod annotation which has the exclude attribute set to true.
This can be tested in a very siple manner: Develop an endpoint implementation class that is annotated with @WebService and add some methods in it. Deploy the project to, for instance, GlassFish and then examine the generated WSDL. Annotate one or more methods with @WebMethod(exclude=true) and deploy again etc.
Best wishes!
subject: Difference between @WebService and @WebServiceProvider
Similar Threads
Usage of @WebserviceProvider in handling SOAP based webservices
Difference between @WebService and @WebServiceProvider annotation?
SOAP message with attachment server-side implementation
Handlers and Providers Interfaces
difference between restful webservice and jersey webservice