I’m learning about web services, and saw various examples. Some of them used @WebService and/or @WebMethod annotations while others don’t. My question is; is it necessary to use these annotations, what is the drawback of not using?
I’m learning about web services, and saw various examples. Some of them used @WebService
Share
Only usage of @WebService annotation is necessary. They are required for more flexibility when developing web services. Just look at javadocs of @WebService and @WebMethod. They have a lot of attributes which define how your service will be exposed because as a rule they are used to generate WSDL-file, so you are able to customize its different parts.
Generally, I’d prefer to use annotation to have a higher flexibility with configuring how my service will look like for its clients.
So these annotations are used to define and customize a contract between your service and its clients.