This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Web Services Certification (SCDJWS/OCPJWSD) and the fly likes Difference between @WebService and @WebServiceProvider annotation? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCPJWSD)
Reply 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
Bartender

Joined: Oct 04, 2006
Posts: 2194
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: 27
hello

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

thanks
Ivan Krizsan
Bartender

Joined: Oct 04, 2006
Posts: 2194
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Difference between @WebService and @WebServiceProvider annotation?
 
Similar Threads
difference between webservice and servlet
Difference between @WebService and @WebServiceProvider
Usage of @WebserviceProvider in handling SOAP based webservices
difference between restful webservice and jersey webservice
exposing WebService to multiple WebService clients without ESB?