This document was uploaded by user and they confirmed that they have the permission to share
it. If you are author or own the copyright of this book, please report to us by using this DMCA
report form. Report DMCA
Java API for XML-Based Web Services Prof. Dr. Eric Dubuis Berner Fachhochschule Biel
Overview
● ● ● ● ●
The motivation for JAX-WS Architecture of JAX-WS and WSDL ↔ JAX-WS Java to WSDL by example Developing a web service Developing a web service client
Note: These slide are about a simple and short introduction on JAX-WS and, therefore, by no means complete.
01/29/08
JAX-WS
2
Why JAX-WS? Given web services, WSDL, XML, and SOAP, JAX-WS defines ... ● ● ●
●
how to program service endpoints in Java how to program web service clients how to program tools that generated otherwise missing intermediaries how to customize the sending and receiving of SOAP messages
when using Java. JAX-WS is an industry standard. Its specification can be found here: http://jcp.org/en/jsr/detail?id=224 JAX-WS defines an user API and a service provider API. We look at the user API only. 01/29/08
JAX-WS
3
Some Goals Being Achieved by JAX-WS ● ● ●
● ●
●
●
01/29/08
Standard mapping of WSDL to Java Standard mapping of Java to WSDL (!) Standard rules for creating artifacts such as stubs and skeletons Standard rules for so-called handlers Standard way of using JAXB, another standard, which defines the Java – XML binding Standard way of introducing security into web services (when using Java) ...
JAX-WS
4
JAX-WS Architecture
●
●
●
01/29/08
Client Application
Service Implementation
Stub / Proxy
Tie
JAX-WS Runtime
JAX-WS Runtime
SOAP messages HTTP transport
The client invokes a stub method which is delegated to the JAX-WS runtime in order to send an appropriate SOAP message to the server On the server side, the tie converts the received message back into a method call on the actual service implementation The stub and tie classes are dynamically generated by the provider platform JAX-WS
5
Relationship between WSDL and JAX-WS
WSDL
Client
●
●
01/29/08
«use»
Service Interface
Service Implementation
JAX-WS can generate a WSDL document from the Java implementation of a web service (code-first) JAX-WS can import a WSDL document to generate the Java code required to implement the web service (contract-first) or a web service client
JAX-WS
6
Java to WSDL Mapping ●
●
●
A class annotated with @WebService is mapped to <portType> element Public Java methods are mapped to elements with corresponding and