• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Usage of @WebserviceProvider in handling SOAP based webservices

 
Ranch Hand
Posts: 558
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic