- What is the difference between a class annotated with @Path and a class annotated with @WebService (What is Service endpoint implementation) ?
After reading the documentation, @WebService is used with SOAP where @Path is for REST.
- Any REST simplest example in java with a web client consumes resource from a service in a same application ? What is the communication method between client and the web service ?
Thanks.
@Pathis for JAX-RS services (i.e., a REST interface) whereas@WebServiceis for JAX-WS services (i.e., a SOAP interface). In principle, it’s entirely possible to have both on the same class – there’s formally no interaction between the two – though I find it simpler in practice to have next to nothing shared between two service interfaces; REST and SOAP seem to have quite different expectations in detail.In REST, clients communicate with servers via HTTP. A significant fraction of REST is in many ways just using HTTP well. I wouldn’t ever want to try to use REST to communicate between a client and a server in the same process though; all that going through the web-server parts just to go from one object to another? Way to much work when you can do a direct method call…