AdvancedTimer.jws Sample

A web service that demonstrates an asynchronous interface to a simulated legacy system (LegacySystem.jws) that does not support asynchrony. It does so by "polling" the legacy system: calling it at intervals to see if it is finished. AdvancedTimer does the polling for the client, invoking a client callback if and when the legacy system responds.

# Concepts Demonstrated by this Sample

- Use of a Timer control

- Use of a Service control

- Declaration and use of a client callback

- Use of the JwsContext interface

- Use of Conversations

- Polling

# Location of Sample Files

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

BEA_HOME\weblogic700\samples\workshop\applications\samples\timer\AdvancedTimer.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/timer/AdvancedTimer.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 start method to create a new conversational instance and invoke the operation on the simulated legacy system.

5. After the legacy system completes it's operation, AdvancedTimer will invoke the onDone callback on the client. If the legacy system does not complete in 15 seconds, AdvancedTimer will invoke the onDone callback anyway, but with a failure indication.

6. Refresh the browser periodically until the callback.onDone 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

Service Control: Using Another Web Service

Maintaining State with Conversations

Using Callbacks to Notify Clients of Events

Using Polling as an Alternative to Callbacks

JwsContext Interface

SimpleTimer.jws Sample

Test View