background image

Packaging and Deploying the Service

<< Coding the Service Endpoint | Testing the Service Without a Client >>
<< Coding the Service Endpoint | Testing the Service Without a Client >>
xx
B
UILDING
W
EB
S
ERVICES WITH
JAX-WS
The compile-service Task
This
asant
task compiles
Hello.java
, writing the class files to the
build
subdi-
rectory. It then calls the
wsgen
tool to generate JAX-WS portable artifacts used
by the web service. The equivalent command-line command is as follows:
wsgen -d build -s build -classpath build
helloservice.endpoint.Hello
The
-d
flag specifies the output location of generated class files. The
-s
flag
specifies the output location of generated source files. The
-classpath
flag
specifies the location of the input files, in this case the endpoint implmentation
class,
helloservice.endpoint.Hello
.
Packaging and Deploying the Service
You package and deploy the service using
asant
.
Upon deployment, the Application Server and the JAX-WS runtime generate any
additional artifacts required for web service invocation, including the WSDL
file.
Packaging and Deploying the Service with
asant
To package and deploy the
helloservice
example, follow these steps:
1. In
a
terminal
window,
go
to
<INSTALL>/javaeetutorial5/examples/jaxws/helloservice/
.
2. Run
asant create-war
.
3. Make sure the Application Server is started.
4. Set
your
admin
username
and
password
in
<INSTALL>/javaeetutorial5/examples/common/build.properties
.
5. Run
asant deploy
.
You can view the WSDL file of the deployed service by requesting the URL
http://localhost:8080/helloservice/hello?wsdl
in a web browser. Now
you are ready to create a client that accesses this service.