background image

Setting the Port

<< Building Web Services with JAX-WS | Requirements of a JAX-WS Endpoint >>
<< Building Web Services with JAX-WS | Requirements of a JAX-WS Endpoint >>

Setting the Port

Setting the Port
Several files in the JAX-WS examples depend on the port that you specified when you installed
the Application Server. The tutorial examples assume that the server runs on the default port,
8080. If you have changed the port, you must update the port number in the following file
before building and running the JAX-WS examples:
tut-install/javaeetutorial5/examples/jaxws/simpleclient/src/java/simpleclient/HelloClient.java
Creating a Simple Web Service and Client with JAX-WS
This section shows how to build and deploy a simple web service and client. The source code for
the service is in tut-install/javaeetutorial5/examples/jaxws/helloservice/ and the client
is in tut-install/javaeetutorial5/examples/jaxws/simpleclient/.
Figure 16­1
illustrates how JAX-WS technology manages communication between a web
service and client.
The starting point for developing a JAX-WS web service is a Java class annotated with the
javax.jws.WebService
annotation. The @WebService annotation defines the class as a web
service endpoint.
A service endpoint interface or service endpoint implementation (SEI) is a Java interface or class,
respectively, that declares the methods that a client can invoke on the service. An interface is not
required when building a JAX-WS endpoint. The web service implementation class implicitly
defines an SEI.
You may specify an explicit interface by adding the endpointInterface element to the
@WebService
annotation in the implementation class. You must then provide an interface that
defines the public methods made available in the endpoint implementation class.
Client
JAX-WS runtime
Service
JAX-WS runtime
SOAP message
FIGURE 16­1
Communication between a JAX-WS Web Service and a Client
Setting the Port
The Java EE 5 Tutorial · September 2007
480