background image

Communication of JAX-WS Web Service

<< Web Service and Client with JAX-WS | Requirements of a JAX-WS Endpoint >>
<< Web Service and Client with JAX-WS | Requirements of a JAX-WS Endpoint >>
C
REATING A
S
IMPLE
W
EB
S
ERVICE AND
C
LIENT WITH
JAX-WS
xvii
Figure 1­1 Communication Between a JAX-WS Web Service and a Client
The starting point for developing a JAX-WS web service is a Java class anno-
tated with the
javax.jws.WebService
annotation. The
WebService
annotation
defines the class as a web service endpoint.
A service endpoint interface (SEI) is a Java interface that declares the methods
that a client can invoke on the service. An SEI is not required when building a
JAX-WS endpoint. The web service implementation class implicitly defines a
SEI.
You may specify an explicit SEI by adding the
endpointInterface
element to
the
WebService
annotation in the implementation class. You must then provide a
SEI that defines the public methods made available in the endpoint implementa-
tion class.
You use the endpoint implementation class and the
wsgen
tool to generate the
web service artifacts and the stubs that connect a web service client to the JAX-
WS runtime. For reference documentation on
wsgen
, see the Application Server
man pages at
http://docs.sun.com/db/doc/817-6092
.
Together, the
wsgen
tool and the Application Server provide the Application
Server's implementation of JAX-WS.
These are the basic steps for creating the web service and client:
1. Code the implementation class.
2. Compile the implementation class.
3. Use
wsgen
to generate the artifacts required to deploy the service.
4. Package the files into a WAR file.