background image

Testing the Service Without a Client

<< Packaging and Deploying the Service | A Simple JAX-WS Client >>
<< Packaging and Deploying the Service | A Simple JAX-WS Client >>
A S
IMPLE
JAX-WS C
LIENT
xxi
Undeploying the Service
At this point in the tutorial, do not undeploy the service. When you are finished
with this example, you can undeploy the service by typing this command:
asant undeploy
Testing the Service Without a Client
The Application Server Admin Console allows you to test the methods of a web
service endpoint. To test the
sayHello
method of
HelloService
, do the follow-
ing:
1. Open the Admin Console by opening the following URL in a web browser:
http://localhost:4848/
2. Enter the admin username and password to log in to the Admin Console.
3. Click Web Services in the left pane of the Admin Console.
4. Click
Hello
.
5. Click Test.
6. Under Methods, enter a name as the parameter to the
sayHello
method.
7. Click the
sayHello
button.
This will take you to the
sayHello
Method invocation page.
8. Under Method returned, you'll see the response from the endpoint.
A Simple JAX-WS Client
HelloClient
is a stand-alone Java program that accesses the
sayHello
method
of
HelloService
. It makes this call through a stub, a local object that acts as a
proxy for the remote service. The stub is created at development time by the
wsimport tool, which generates JAX-WS portable artifacts based on a WSDL
file.
Coding the Client
When invoking the remote methods on the stub, the client performs these steps:
1. Uses the
javax.xml.ws.WebServiceRef
annotation to declare a reference
to a web service.
WebServiceRef
uses the
wsdlLocation
element to spec-
ify the URI of the deployed service's WSDL file.