# JAX-WS (SOAP) vs JAX-RS (RESTful)

In 
SOAP
REST
Published 2022-12-03

This tutorial explains you which are the Java web service types. You will understand the difference between JAX-WS (SOAP) and JAX-RS (RESTful).

When you create a Java Web Service you can use JAX-WS (SOAP) or JAX-RS (RESTful).

Into the following picture you will see the main types of Java Web Services:

As you can see there are 2 principal types of Web Services: SOAP and RESTful.

Into the Java World, the SOAP Web Services are done using JAX-WS (Java API for XML - Web Services) and the RESTful Web Services are done using JAX-RS (Java API for XML - RESTful Web Services).

As you can see in the picture above, the JAX-WS can be realized using 2 style. You have to choose the style function of the complexity of the Java Web Service you want to create. The RPC Style contains simple data types. The Document Style contains complex data types and it is a Message-Oriented Style. The Document Style has also the advantage of validating the XML message against a XSD (XML Schema Document) file.

JAX-RS has 2 main implementations: Jersey and RESTeasy.

Here are a comparison between JAX-WS (SOAP) and JAX-RS (RESTful):