This post is about the requirement of JAX-WS endpoint and this is very important to understand the minimum requirements to implement a Java JAX-WS web service.
Everyone either you are implementor or developer or architect or lead or manager of Java web services, you must know JAX-WS requirements. By knowing this, you reach on the conclusion, what you should do and what you should not do. This post is essential for all roles who is concerned about Java web service.
1. JAX-WS endpoints must follow following requirements
Here, you know about JAX-WS
- The implementing class for JAX-WS Java web services, must be annotated with either the
javax.jws.WebService
or thejavax.jws.WebServiceProvider
annotation. - 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. - The business methods of the implementing class must be
public
and must not be declaredstatic
orfinal
. - Business methods that are exposed to web service clients must be annotated with
javax.jws.WebMethod
. - Business methods that are exposed to web service clients must have
JAXB-compatible
parameters and return types. - The implementing class must not be declared
final
and must not beabstract
. - The implementing class must have a default public constructor.
- The implementing class must not define the
- finalize
- The implementing class may use the
javax.annotation.PostConstruct
or thejavax.annotation.PreDestroy
annotations on its methods for lifecycle event callbacks.
method.
2. 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.
3. Reference for JAX-WS endpoints
Thanks for visiting this post for the Requirement of JAX-WS endpoint. You can visit JAX-WS web services tutorial page.
Your comments are welcome to improve this post. Happy Learning! 🙂