Академический Документы
Профессиональный Документы
Культура Документы
JAX-WS
indigoo.com
Peter R. Egli
INDIGOO.COM
1/20
Rev. 2.00
indigoo.com
Contents
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
What is JAX-WS?
Glassfish = Reference implementation for JAX-WS
Glassfish projects, Java packages
POJO / Java bean as web service class
JAX-WS JavaBeans versus provider endpoint
JAX-WS dispatch client versus dynamic client proxy API
JAX-WS development / deployment
JAXB Binding XML documents to Java objects
JAXR JAVA API for XML Registries
WSIT Web Service Interoperability Technologies
Short comparison of important Java WS stacks
2/20
Rev. 2.00
indigoo.com
1. What is JAX-WS?
JAX-WS is the core Java web service technology (standard for Java EE):
JAX-WS is the standard programming model / API for WS on Java (JAX-WS became a
standard part of Java as of version 1.6).
JAX-WS is platform independent (many Java platforms like Glassfish, Axis2 or CXF
support JAX-WS). Services developed on one platform can be easily ported to another
platform.
JAX-WS makes use of annotations like @WebService. This provides better scalability (no
central deployment descriptor for different WS classes is required).
JAX-WS uses the POJO concept (use of plain Java classes to define web service
interfaces).
JAX-WS replaces / supersedes JAX-RPC (= old Java web services, basically RMI over
web service). JAX-WS is more document orientiented instead of RPC-oriented.
Glassfish
3/20
Rev. 2.00
indigoo.com
WSIT
JAX-WS
XML
Transports
Peter R. Egli 2015
Security
RM
Transactions
Metro stack
JAX-WS (core WS)
JSR-224
Jersey
(JAX-RS)
Metadata
CORBA
OpenMQ
WSDL
Policy Grizzly /
JAXR EJB1)
COMET
JAXB
JSR-222
JAXP
StaX
JSR-173
SAAJ
HTTP
TCP
JMS
SMTP
indigoo.com
Glassfish is developed in various independent projects. Together, they build the Glassfish
service platform.
Parent project
Project
Description
Java package
Glassfish
GF-CORBA
CORBA
com.sun.corba.se.*
Glassfish
OpenMQ
JMS
javax.jms.*
Glassfish
WADL
org.vnet.ws.wadl.*
org.vnet.ws.wadl2java.*
Glassfish
REST services
javax.ws.rs.*
jax-ws-xml, jwsdp
JAXB
javax.xml.bind.*
jax-ws-xml, jwsdp
JAX-RPC
java.xml.rpc.*
Metro (Glassfish)
JAX-WS
javax.jws.*
javax.xml.ws.*
Metro (Glassfish)
SAAJ
SOAP attachments
javax.xml.soap.*
Metro (Glassfish)
WSIT (previously
Tango)
Various
5/20
Rev. 2.00
indigoo.com
@PostConstruct
public void init() {...}
@PreDestroy
public void teardown() {...}
}
Peter R. Egli 2015
6/20
Rev. 2.00
indigoo.com
@WebService(endpointInterface=IHello)
public class HelloWorld
{
public String sayHello() {...}
}
7/20
Rev. 2.00
indigoo.com
The annotation @WebService is a high-level annotation to turn a POJO into a web service.
The @WebServiceProvider is lower-level and gives more control over the web service.
Service consumer
Service provider
Application
Application
@WebService
RPC call
(API)
Procedure
(marshaling)
SOAP
engine
SOAP
engine
HTTP
engine
HTTP
engine
Application
@WebServiceProvider
8/20
Rev. 2.00
indigoo.com
9/20
Rev. 2.00
indigoo.com
10/20
Rev. 2.00
indigoo.com
Dynamic
proxy client
API
Service consumer
Service provider
Application
Application
RPC call
(API)
Procedure
(marshaling)
SOAP
engine
SOAP
engine
HTTP
engine
HTTP
engine
Dispatch
client API
11/20
Rev. 2.00
indigoo.com
12/20
Rev. 2.00
indigoo.com
13/20
Rev. 2.00
indigoo.com
*.java
javac.exe
*.class
wsgen.exe
Code
JAXB
Code
classes
Platform
specific
packaging
and
deployment
WAR,
AAR etc.
WSDL
file
Service description
as WSDL file
14/20
Rev. 2.00
indigoo.com
WSDL
file
wsimport.exe
wsimport.exe
web.xml
(deployment
descriptor,
optional)
Server
Code
Code
stub
classes
Platform
specific
packaging
and
deployment
WAR,
AAR etc.
client
Code
Code
stub
files
15/20
Rev. 2.00
indigoo.com
Relationship between
schema, document, Java
objects and classes with
JAXB:
JAXB
JAXB
JAXB
mapped
mapped
mapped
classes
classes
classes
bind
follows
Document
(XML)
instances of
unmarshal
(validate)
Objects
Objects
Objects
marshal
(validate)
xsd:string
java.lang.String
xsd:integer
java.math.BigInteger
xsd:int
int
xsd:long
long
xsd:short
short
16/20
Rev. 2.00
indigoo.com
JAXR is a uniform and standard API for accessing different kinds of XML registries.
XML registries are used for registering (by server / service) and discovering (by client) web
services.
JAXR follows the well-known pattern in Java with a service provider interface (SPI for
registering XML metadata) and a client interface (see also JMS or JNDI).
JAXR Client
JAXR API
Capability-Specific Interfaces
ebXML
Provider
ebXML /
SOAP
ebXML
UDDI
Provider
UDDI /
SOAP
UDDI
Other
Provider
Registry-specific
JAXR provider
Other
Other
Registries
Source: docs.oracle.com
Peter R. Egli 2015
17/20
Rev. 2.00
indigoo.com
18/20
Rev. 2.00
indigoo.com
JAX-WS
(Metro@Glassfish)
Microsoft
WCF
Description
Yes (JAX-WS)
Yes
WS-MetadataExchange
Yes (WSIT)
Yes
WS-Transfer
Yes (WSIT)
Yes
WS-Policy
Yes (WSIT)
Yes
WS-Security
Yes (WSIT)
Yes
WS-SecureConversation
Yes (WSIT)
Yes
WS-Trust
Yes (WSIT)
Yes
WS-SecurityPolicy
Yes (WSIT)
Yes
WS-ReliableMessaging
Yes (WSIT)
Yes
WS-RMPolicy
Yes (WSIT)
Yes
WS-Coordination
Yes (WSIT)
Yes
WS-AtomicTransaction
Yes (WSIT)
Yes
WS-BusinessActivity
No
WS-Eventing
No
No
WS-Notification
No
No
19/20
Rev. 2.00
indigoo.com
20/20
Rev. 2.00