wood burning stoves 2.0*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Help in understanding javax.xml.ws.Provider<T> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Help in understanding javax.xml.ws.Provider<T>" Watch "Help in understanding javax.xml.ws.Provider<T>" New topic
Author

Help in understanding javax.xml.ws.Provider<T>

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

Hi All,

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.

Thanks


Regards
KumarRaja

Hany Shafik
Ranch Hand

Joined: Jun 21, 2008
Posts: 80
Hi Kumar,

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
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

Thank you Hany.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help in understanding javax.xml.ws.Provider<T>
 
Similar Threads
Difference between @WebService and @WebServiceProvider annotation?
Hi..help required
Receiving empty SOAP requests
Regarding javax.xml.ws.Provider interface
Is there a tutorial for SOAP 1.2 HTTP GET using JAX-WS?