This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
This question is related to the topic "String Processor Web Service Example (Provider)" page 155 from Ivan's notes.
I did not understand the objective of this topic and its relationship to javax.xml.ws.Provider<T>. It would be great if somebody, could show me some guidance.
A web service can also be written to process entire protocol messages, usually SOAP, or message
payloads, which in the case with SOAP is the contents of the SOAP body element.
Such a web service class will implement the javax.xml.ws.Provider<T> interface and be annotated
with the @WebServiceProvider annotation.
What does it mean by processing the entire protocol message/payload. This is what every webservice does. Why should this implement Provider interface? How is this different from earlier example given in Ivans which does not implement any interface but the required server side artifacts are generated using wsgen.
Bottomline, what is the purpose of this interface and how is this different from normal webservice where it need not imlement Provider.
There is two ways to provide a web service in jax-ws. One of them is to provide normal java interface and the interface is mapped to a wsdl through jax-ws annotation. This has the advantage of being at a high level meaning you don't have to worry yourself about the grim details about soap message and parsing the xml content and mapping it your java objects, as this part is handled by the jax-ws provider. Also you don't concern yourself with generating the xml response conformant to your wsdl.
The second method is to implement Provider interface, if you have your service implement such method you will have to work on these low level issues related to parsing and mapping/serializing and dispatching code for each soap request also handling the response by creating the appropriate xml response.
You can choose whatever method appropriate depending on your case as each method has it's own advantages and disadvantages.
Hope this helps