Requirements of JAX-WS Endpoint

Connect with

Oracle Java
This post is about the requirement of JAX-WS endpoint and this is very important to understand minimum requirment to implement. Every one (implementor/developer/architect/lead etc..) should know JAX-WS requirement. By knowing this, you can say, what you should do and what you should not do.

JAX-WS endpoints must follow following requirements.

  1. The implementing class must be annotated with either the javax.jws.WebService or the javax.jws.WebServiceProvider annotation.
  2. The implementing class may explicitly reference an SEI through the endpointInterface element of the @WebService annotation but is not required to do so. If no endpointInterface is specified in @WebService, an SEI is implicitly defined for the implementing class.
  3. The business methods of the implementing class must be public and must not be declared static or final.
  4. Business methods that are exposed to web service clients must be annotated with javax.jws.WebMethod.
  5. Business methods that are exposed to web service clients must have JAXB-compatible parameters and return types.
  6. The implementing class must not be declared final and must not be abstract.
  7. The implementing class must have a default public constructor.
  8. The implementing class must not define the
  9. finalize
  10. method.

  11. The implementing class may use the javax.annotation.PostConstruct or the javax.annotation.PreDestroy annotations on its methods for lifecycle event callbacks.

Life Cycle callback methods

Usually annotation : @PreDestroy and @PostConstruct can be used for callback.

  • The @PostConstruct method is called by the container before the implementing class begins responding to web service clients.
  • The @PreDestroy method is called by the container before the endpoint is removed from operation.

Reference

Your comments are welcome to improve this post. Happy Learning 🙂


Connect with

Leave a Reply

Your email address will not be published. Required fields are marked *