HelloWorldAsync.jws Sample

A simple asynchronous web service that illustrates the use of a callback. Uses a Timer control to provide a delay that simulates waiting for a slow back-end service to do some work, then notifies the client of the result via a callback. HelloWorldAsync.jws is used by the Conversation.jws sample, but is also a standalone web service.

# Concepts Demonstrated by this Sample

- Use of a Timer control

- Declaration and use of a client callback

- Use of Conversations

# Location of Sample Files

This sample is located in the async folder of the samples WebLogic Workshop project. In the file system the location is:

BEA_HOME\weblogic700\samples\workshop\applications\samples\async\HelloWorldAsync.jws

# How to Run the Sample

To run this web service:

1. Start WebLogic Server in the appropriate domain.

   - On Microsoft Windows systems, from the Start menu navigate to:

   BEA WebLogic Platform 7.0->WebLogic Workshop->WebLogic Workshop Examples->Start Examples Server.

   - On Linux or Solaris systems, run:

   BEA_HOME/weblogic700/samples/workshop/startWebLogic.sh

2. Launch the service either by opening it in WebLogic Workshop and selecting the Start operation or by entering http://localhost:7001/samples/async/HelloWorld.jws in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine, you may click here to run the sample.

3. Navigate to the Test Form tab of Test View, if necessary.

4. Invoke the HelloAsync method to create a new conversational instance and invoke the simulated legacy system operation.

5. After 5 seconds, HelloWorldAsync will invoke the onHelloResult callback on the client.

6. Refresh the browser periodically until the callback.onHelloResult callback entry appears in the Message Log.

7. Select log entries in the Message Log to see the message traffic involved in each interaction.

Related Topics

Controls: Using Resources from a Web Service

Timer Control: Using Timers in Your Web Service

Maintaining State with Conversations

Test View