JAX WS overview
JAX-WS stands for Java API for XML based web service
JAX-WS is the successor of JAX-RPC 1.1.
JAX-RPC 2.0 specification is renamed as JAX-WS 2.0
It provides the APIs for developing web services in XML format.
It provides many annotations to develop web services and clients and hence reduces the development effort.
Java 1.6 and above has provided JAX-WS APIs , we just need to add implementations or providers of these APIs.
In case, if you are using Java 1.5 or lower versions, then you need to add JAX-WS jars manually.
We can develop the SOAP web services using JAX-WS and can be published with Web server like Tomcat.
JAX-WS communication between web service and client
As we can see in the diagram that JAX-WS runtime in both client and service enables the communication between them through SOAP message.
Class annotated with @WebService or @WebServiceProvider annotation becomes the web service endpoint.
@WebService annotation can define the SEI through endpointInterface element but its optional.
If endpointInterface element is not defined with @WebService annotation then JAX-WS implicitly defines it.
Business methods that are exposed to web service clients must be annotated with @WebMethod and these methods should be public and should not be made as final or static.
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 be abstract.
The implementing class must have a default public constructor.
The implementing class must not define the finalize method.
We know that JAX-WS provides just the API specification to develop web service and clients,but we need implementations of these JAX-WS specifications.
Some of the implementaions of JAX-WS specifications are
Apache Axis 2
JAX-WS provides below tools to work with web service (both provider and consumer)
It is used to parse the given WSDL file and generates the required files (jax-ws portable artifacts)
such as Service end point interface(SEI) and Service class
It is used to read the web service implementation class and generate the required files (jax-ws portable artifacts)
such as java classes and WSDL files for web service deployment.