Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between JAX-RS and JAX-WS?

After reading a few articles about JAX-RS and JAX-WS, I had a few questions that I want to confirm?

  1. Can JAX-RS do Asynchronous Request like JAX-WS?
  2. Can JAX-RS access a web service that is not running on the Java platform, and vice versa?
  3. What does it mean by "REST is particularly useful for limited-profile devices, such as PDAs and mobile phones"?
  4. What does it mean by "JAX-RS do not require XML messages or WSDL service–API definitions?
like image 299
pmark019 Avatar asked May 14 '13 09:05

pmark019


People also ask

What does JAX-WS stand for?

JAX-WS stands for Java API for XML Web Services. JAX-WS is a technology for building web services and clients that communicate using XML. JAX-WS allows developers to write message-oriented as well as RPC-oriented web services.

What is the purpose of using JAX-RS?

JAX-RS is a Java programming language API designed to make it easy to develop applications that use the REST architecture. The JAX-RS API uses Java programming language annotations to simplify the development of RESTful web services.

Is Jax and Jersey RS the same?

JAX-RS is an specification (just a definition) and Jersey is a JAX-RS implementation. Jersey framework is more than the JAX-RS Reference Implementation. Jersey provides its own API that extend the JAX-RS toolkit with additional features and utilities to further simplify RESTful service and client development.

Is JAX-WS is the API for REST?

JAX-WS is a fundamental technology for developing SOAP (Simple Object Access Protocol) and RESTful (Web services that use representational state transfer, or REST, tools) Java Web services, where JAX-WS is designed to take the place of the JAVA-RPC (Remote Procedure Call) interface in Web services and Web-based ...


2 Answers

Another important point

JAX-WS represents SOAP

JAX-RS represents REST

How to choose between JAX-RS and JAX-WS web services implementation?

like image 124
user2849471 Avatar answered Oct 06 '22 11:10

user2849471


Can JAX-RS do Asynchronous Request like JAX-WS?

1) I don't know if the JAX-RS API includes a specific mechanism for asynchronous requests, but this answer could still change based on the client implementation you use.

Can JAX-RS access a web service that is not running on the Java platform, and vice versa?

2) I can't think of any reason it wouldn't be able to.

What does it mean by "REST is particularly useful for limited-profile devices, such as PDAs and mobile phones"?

3) REST based architectures typically will use a lightweight data format, like JSON, to send data back and forth. This is in contrast to JAX-WS which uses XML. I don't see XML by itself so significantly heavier than JSON (which some people may argue), but with JAX-WS it's how much XML is used that ends up making REST with JSON the lighter option.

What does it mean by "JAX-RS do not require XML messages or WSDL service–API definitions?

4) As stated in 3, REST architectures often use JSON to send and receive data. JAX-WS uses XML. It's not that JSON is so significantly smaller than XML by itself. It's mostly that JAX-WS specification includes lots overhead in how it communicates.

On the point about WSDL and API definitions, REST will more frequently use the URI structure and HTTP commands to define the API rather than message types, as is done in the JAX-WS. This means that you don't need to publish a WSDL document so that other users of your service can know how to talk to your service. With REST you will still need to provide some documentation to other users about how the REST service is organized and what data and HTTP commands need to be sent.

like image 32
Nick Roth Avatar answered Oct 06 '22 13:10

Nick Roth