Java API for XML Web Services

from Wikipedia, the free encyclopedia

The Java API for XML Web Services ( JAX-WS ) is a Java - API for creating Web services . JAX-WS was introduced in Java Platform Enterprise Edition 5 and from version 1.6 is also part of Java Platform, Standard Edition .

JAX-WS is based on JAX-RPC , is part of Web Services Interoperability Technology and therefore also part of the so-called Metro platform . Like other Java EE - APIs also uses JAX-WS annotations to the development and deployment of web service clients and simplify service endpoints.

How JAX-WS works

The client and endpoint communicate using SOAP messages. JAX-WS uses SAAJ to generate SOAP messages. JAX-WS is protocol and transport independent. However, SOAP 1.1 and HTTP are used by default.

In order to be able to process the data correctly, the XML data types must be converted into Java-compliant data types. JAX-WS delegates this to JAXB ( Java Architecture for XML Binding ). In this way, the XML processing can essentially remain hidden from the programmer.

Create web service endpoints and clients

Server side

There are two different ways to set up service endpoints: Code First (Bottom Up) via POJOs and Contract First (Top Down) via WSDL .

Start with POJOs (Bottom Up)

In contrast to the previous development method ( JAX-RPC ), in which an interface is defined to create a web service endpoint and a class is written that implements the interface, with JAX-WS only POJOs that are already available in an application can be used become. In order to make this possible, these are extended to a web service using Java annotations . The annotations also make the deployment descriptors superfluous.

Start with WSDL (Top Down)

Classes are generated from the WSDL description of the service interface and supplemented by the user.

Client side

A local proxy object must be created on the client side, which also implements the web service interface (generated from WSDL). With JAX-WS, the client does not get its proxy from a factory. It constructs a ServiceObject with the new operator, calls the get Service Port method to get a proxy, and executes its method calls on the proxy object as if the web service were available locally. The JAX-WS runtime environment forwards the calls from the proxy object to the web service, which then carries out the operations and sends the result back to the client.

Supported WS- * standards

The following WS- * standards are implemented in the JAX-WS reference implementation:

Only WSDL 1.1 is currently supported, not WSDL 2.0.

Web links

Individual evidence

  1. Introducing JAX-WS 2.0 With the Java SE 6 Platform, Part 1
  2. http://wiki.apache.org/ws/StackComparison
  3. 1.4. Metro Specifications