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.

Note

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

jaxws-simpleClientAndService

As we can see in the diagram that JAX-WS runtime in both client and service enables the communication between them through SOAP message.

JAX-WS endpoint


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

Apache Axis 2

Apache CXF

GlassfFsh Metro


JAX-WS provides below tools to work with web service (both provider and consumer)

1. wsimport

2. wsgen


1. wsimport

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

JAX_WS-overview_wsimport


2. wsgen

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.


AX_WS-overview_wsgen

About the Author

Karibasappa G C (KB)
Founder of javainsimpleway.com
I love Java and open source technologies and very much passionate about software development.
I like to share my knowledge with others especially on technology 🙂
I have given all the examples as simple as possible to understand for the beginners.
All the code posted on my blog is developed,compiled and tested in my development environment.
If you find any mistakes or bugs, Please drop an email to kb.knowledge.sharing@gmail.com

Connect with me on Facebook for more updates

Share this article on