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.
Ivan Krizsan wrote:
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.
In another words, it is impossible to do bottom-up service development using @WebServiceProvider annotation? Please correct if wrong; if yes then how to consume the service?
@WebServiceProvider is used for XML based web services, not necessarily SOAP based web service.
With it, developers will need to parse the XML request or response using the XML parsers.
With it, no WSDL is generated. But with @WebService, a wsdl is generated.
If the service is annotated with @WebServiceProvider is implemented RESTfully (with Create, Update, Delete, Get methods), then it is a REST service.
Detail is given in Java Web Service Up and Running.