background image

Requirements of a JAX-WS Endpoint

<< Communication of JAX-WS Web Service | Coding the Service Endpoint >>
<< Communication of JAX-WS Web Service | Coding the Service Endpoint >>
xviii
B
UILDING
W
EB
S
ERVICES WITH
JAX-WS
5. Deploy the WAR file. The tie classes (which are used to communicate with
clients) are generated by the Application Server during deployment.
6. Code the client class.
7. Use
wsimport
to generate and compile the stub files.
8. Compile the client class.
9. Run the client.
The sections that follow cover these steps in greater detail.
Requirements of a JAX-WS Endpoint
JAX-WS endpoints must follow these requirements:
· The
implementing
class
must
be
annotated
with
either
the
javax.jws.WebService
or
javax.jws.WebServiceProvider
annota-
tion.
· The implementing class may explicitly reference an SEI through the
end-
pointInterface
element of the
@WebService
annotation, but is not
required to do so. If no endpointInterface is not specified in
@WebService
,
an SEI is implicityly defined for the implementing class.
· The business methods of the implementing class must be public, and must
not be declared
static
or
final
.
· Business methods that are exposed to web service clients must be anno-
tated with
javax.jws.WebMethod
.
· Business methods that are exposed to web service clients must have JAX-
B-compatible parameters and return types. See Default Data Type
Bindings (page 6).
· The implementing class must not be declared
final
and must not be
abstract
.
· The implementing class must have a default public constructor.
· The implementing class must not define the
finalize
method.
· The implementing class may use the
javax.annotation.PostConstruct
or
javax.annotation.PreDestroy
annotations on its methods for lifecy-
cle event callbacks.
The
@PostConstruct
method is called by the container before the imple-
menting class begins responding to web service clients.