background image

Requirements of a JAX-WS Endpoint

<< Setting the Port | Coding the Service Endpoint >>
<< Setting the Port | Coding the Service Endpoint >>

Requirements of a JAX-WS Endpoint

You use the endpoint implementation class and the wsgen tool to generate the web service
artifacts that connect a web service client to the JAX-WS runtime. For reference documentation
on wsgen, see the Sun Java System Application Server 9.1 Reference Manual.
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.
5. Deploy the WAR file. The web service artifacts (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 web service artifacts needed to connect to the
service.
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
annotation.
The implementing class may explicitly reference an SEI through the endpointInterface
element of the @WebService annotation, but is not required to do so. If no
endpointInterface
is specified in @WebService, an SEI is implicitly 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 annotated with
javax.jws.WebMethod
.
Business methods that are exposed to web service clients must have JAXB-compatible
parameters and return types. See
"Default Data Type Bindings" on page 493
.
The implementing class must not be declared final and must not be abstract.
The implementing class must have a default public constructor.
Creating a Simple Web Service and Client with JAX-WS
Chapter 16 · Building Web Services with JAX-WS
481