Working with JAX-WS

The course is part of this learning path

Introduction to JAX-WS

In this course, you will learn about JAX-WS, a SOAP (simple object access protocol) web service used by Java, as well as its main components.

Learning Objectives

  • Understand the basics of JAX-WS and what it does
  • Learn about endpoints, dynamic endpoints, dynamic clients, and handlers in JAX-WS

Intended Audience

This course is intended for anyone who already has basic knowledge of Java and now wants to learn about Java EE 6.


Basic knowledge of Java programming.



Hello dear friends. In this video, we will start to examine JAX-WS, let's begin. JAX-WS is a SOAP web service used by Java. First, let's start with SOAP. SOAP stands for simple object access protocol. It's an XML based protocol for accessing web services. SOAP is a W3C recommendation for communication between two applications. SOAP is XML based protocol. It's platform independent and language independent. By using SOAP, you are able to interact with other programming language applications. What are the advantages of SOAP?

When developing SOAP based web services, you need to have some knowledge of the language which can be used for web services to talk with client applications. SOAP is the perfect medium which was developed in order to achieve this purpose. This protocol is also recommended by the W3C Consortium, which is the governing body for all web standards. SOAP is a lightweight protocol that is used for data interchange between applications. Since SOAP programming is based on the XML language, which itself is a lightweight data interchange language, hence SOAP as a protocol also falls in the same category.

SOAP is designed to be platform independent and is also designed to be operating system independent. So, the SOAP protocol can work with any programming language based applications on both Windows and Linux platform. SOAP works on the HTTP protocol, which is the default protocol used by all web applications. Hence, there is no sort of customization which is required to run the web services built on the SOAP protocol to work on the World Wide Web. Of course, SOAP has some disadvantages. So, let's talk about the disadvantages of SOAP. SOAP uses XML format that must be parsed to be read. It defines many standards that must be followed while developing the SOAP applications, so it is slow and consumes more bandwidth and resources. SOAP uses WSDL and doesn't have any other mechanism to discover the service. 

WSDL documents are hosted in the Web Service Container and use XML to describe what a service does, how to invoke its operations, and where to find it. That's all I have about the SOAP concept. Let's look at SOAP in Java. JAX-WS is an abbreviation of Java API for XML based web services, and is a Java standard API for handling web services using SOAP, etc. Using JAX-WS, Java objects can be sent by converting the same to XML in conformance with SOAP specifications. Therefore, although information is exchanged in SOAP Web Service using XML, the user can handle the data without being aware of XML structure. Main Java EE Servers like Oracle WebLogic Server or JBoss Enterprise Application Platform use JAX-WS implementation on server side, and can easily publish web service by using the function without adding a specific library.

However, since Tomcat does not implement JAX-WS, a separate JAX-WS implementation library must be added while using Tomcat. Web services are applications designed to communicate with each other over a network, typically exchanging information in XML or other structured text formats. Web services are platform independent. A typical JAX-WS application uses a client server model. The server component is called a web service endpoint. JAX-WS has a counterpart for smaller and simpler web services, which uses a protocol called JAX-RS. JAX-RS is a protocol for representational state transfer or REST. JAX-RS applications are typically lightweight and rely only on the HTTP protocol itself for communication. JAX-WS makes it easier to support various web service oriented protocols such as WS-Notification, WS-Addressing, WS-Policy, WS-Security, and WS-Trust. They communicate using a specialized XML language called simple object access protocol, SOAP, which defines a message architecture and message formats. A JAX- WS web services also includes a machine readable description of the operations it provides written in Web Services Description Language as WSDL, which is a specialized XML document type.

A web service endpoint consists of a class which implements web service and web method interfaces. A Web Service Client consists of a client which depends upon several classes called stubs, which are generated from the WSDL definition. JBoss Enterprise Application Platform includes the tools to generate the classes from WSDL. In a JAX-WS web service, a formal contract is established to describe the interface that the web service offers. The contract is typically written in WSDL, but may be written in SOAP messages. The architecture of the web service typically addresses business requirements such as transactions, security, messaging, and coordination. 

JBoss Enterprise Application Platform provides mechanisms for handling these business concerns. Web services description language such as WSDL is an XML based language used to describe web services and how to access them. The web service itself is written in Java or another programming language. The WSDL definition consists of references to the interface, port definitions, and instructions for how other web services should interact with it over a network. Web services communicate with each other using Simple Object Access Protocol. JBoss Enterprise Application Platform includes support for deploying JAX-WS web service endpoints.

This support is provided by JBoss-WS. Configuration of the web services subsystem such as endpoint configuration, handler chains and handlers is provided through the web services subsystem. JAX-WS is the new name of JAX-RPC. JAX-RPC has been pruned in Java EE 6, meaning that it is proposed to be removed from Java EE 7. Java SOAP support was deprecated with JDK9 and removed from the programming language with JDK 11. However, since this tutorial was made for Java 6 EE, it is still a topic in use for us. JAX-WS 2.2 defines a set of APIs and annotations that allow you to build and consume web services with Java. 

It provides the consumer and service facilities to send and receive web service requests via SOAP, masking the complexity of the protocol. Therefore, neither the consumer nor the service has to generate or parse SOAP messages as JAX-WS deals with the low-level processing. The JAX-WS specification depends on other specifications, such as Java architecture for XML binding. Like most of the Java EE 6 components, web services rely on the configuration by exception paradigm, which specifies that configuring a component is the exception. Only one annotation is actually needed to turn a Poggio into a web service. That's all I have to say about the JAX-WS concept. We'll continue with the web service endpoints in the following video. See you in the following video.


About the Author
Learning Paths

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.

Covered Topics