How-to Create J2EE 1.4 Web Services Client

Contents

Overview

This example demonstrates a J2EE Application client consuming a Web Service.

Quick Start

Ensure that you have installed the required software and set up your environment. You must have OC4J running. If it is not running on localhost, port 8888, you'll have to modify the ANT script , build.xml, to use the correct host and port to your server.

In addition to having the server configured and running, you also need to make sure that the Web Service referenced by this example has been deployed and is running. The end point address of the service is http://localhost:8888/hello/HelloService. This can be achieved by deploying the demo /basic/stateless/ - just type ant from the basic/stateless directory.

Once you have the server configured and running, just type ant from the ejb-client directory. The ant build.xml is configured for easily running this demo.

Step By Step

Step 1 - Assemble the application

To create the appclient jar file, type: ant assemble.
This results in a J2EE Web Services compliant application file: dist/consumerAppClient.jar.

Step 2 - Run the Client

To run the client, type: ant run. You should see output such as the following.

run-demo:

  [java] client started...
  [java] result from service Hello ..App Client..!

Note: The client can be run with the flag '-DlookupOnDemand=true' when the client does not have to go to the server for the JNDI tree reference.