Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile 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

Usage of @WebserviceProvider in handling SOAP based webservices

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 533

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 ?


Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
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:
I agree. Here's the link:
subject: Usage of @WebserviceProvider in handling SOAP based webservices