File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Usage of @WebserviceProvider in handling SOAP based webservices 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 "Usage of @WebserviceProvider in handling SOAP based webservices" Watch "Usage of @WebserviceProvider in handling SOAP based webservices" New topic
Author

Usage of @WebserviceProvider in handling SOAP based webservices

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

Hello All,

We know that we can implement a service by implementing Provider<T> interface and by annotating the class with @WebserviceProvider. This approach would help us in dealing with raw XML. But while I was reading through Java webservices up and running by Martin Kalin, I came across the below statement from him about Restful WS


The @WebService annotation signals that the messages exchanged between the service and its clients will be SOAP envelopes. The @WebServiceProvider signals that the exchanged messages will be XML documents of some type, a notion captured in the phrase raw XML. Of course, a @WebServiceProvider could process and generate SOAP on its own, but this approach is not recommended. (A later example illustrates, however.) The obvious way to provide a SOAP-based web service is to use the annotation @WebService.


When @WebserviceProvider gives us the flexibility of handling at xml level, why would author feel that it is not a recommended approach for SOAP based webservice, but instead recommends for REST style WS.

Can anyone who read this book shed some light on this ?


Regards
KumarRaja

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Using the @WebServiceProvider annotation to develop SOAP web service endpoints will cause a lot of extra work for you.
When using @WebService, the whole SOAP part, as well as marshalling and unmarshalling of the payload, is taken care of for you by the web service stack.
If you use @WebServiceProvider, then you will have to implement the code that does this yourself.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Usage of @WebserviceProvider in handling SOAP based webservices
 
Similar Threads
Is calling a method on stub a RPC style of webservice ?
Question on Asynchronous web service call using document style.
Webservice implementing Provider<Source>: no difference with service mode MESSAGE or PAYLOAD
Regarding javax.xml.ws.Provider interface
Help in understanding javax.xml.ws.Provider<T>