Two Laptop Bag*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Difference between @WebService and @WebServiceProvider annotation? 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 "Difference between @WebService and @WebServiceProvider annotation?" Watch "Difference between @WebService and @WebServiceProvider annotation?" New topic
Author

Difference between @WebService and @WebServiceProvider annotation?

Mahabub Ali Mohammad
Greenhorn

Joined: Oct 30, 2008
Posts: 3
Hi All,

Can anyone explain me the difference between annotating a java service with @WebService and @WebServiceProvider?

Thanks in Advance
-Mahabub Ali Mohammad.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
The annotation WebServiceProvider is used in endpoint classes implementing the javax.xml.ws.Provider<T> to associate the class with a <wsdl:service> element and a <wsdl:port> element in specified WSDL document. Such an endpoint works directly with (SOAP) messages or (SOAP) message payloads.
Note that the Provider<T> interface only has one single method, which in an implementing class will provide all the different messages received by the endpoint, while a class annotated with the WebService has one method for each kind of message the endpoint class can receive.
A class can either be annotated with the WebService or the WebServiceProvider annotation, but not both.

My free books and tutorials: http://www.slideshare.net/krizsan
Mahabub Ali Mohammad
Greenhorn

Joined: Oct 30, 2008
Posts: 3
Thanks Navi

Regards,
Mahabub Ali Mohammad.
anas alsarairah
Greenhorn

Joined: Sep 27, 2007
Posts: 28
hello

do you mean that the application server wont generate a WSDL file for web services annonated using @WebServiceProvider ?

thanks
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
anas alsarairah wrote:
do you mean that the application server wont generate a WSDL file for web services annonated using @WebServiceProvider ?

Correct - there is no way the application server knows what operations etc are supported by a web service annotated with @WebServiceProvider.
You may, however, supply an existing WSDL.
Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between @WebService and @WebServiceProvider annotation?
 
Similar Threads
Usage of @WebserviceProvider in handling SOAP based webservices
Difference between @WebService and @WebServiceProvider
difference between webservice and servlet
difference between restful webservice and jersey webservice
exposing WebService to multiple WebService clients without ESB?