SimpleTimer.jws Sample

A simple web service that demonstrates use of the Timer control. Uses the @jc:timer timeout= tag.

Concepts Demonstrated by this Sample

Location of Sample Files

This sample is located in the timer folder of the WebServices project in the SamplesApp sample application. In the file system the location is:

BEA_HOME\weblogic81\samples\workshop\SamplesApp\WebServices\timer\SimpleTimer.jws

To Run the Sample

  1. Start WebLogic Server in the appropriate domain.
  2. Launch the service either by opening it in WebLogic Workshop and selecting the Start operation or by entering http://localhost:7001/WebServices/timer/SimpleTimer.jws in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine and you have deployed the SamplesApp sample application, you may click here to run the sample.
  3. Navigate to the Test Form tab of Test View, if necessary.
  4. Invoke the createTimer method to create a new conversational instance.
  5. Click on the conversation ID (the large number) in the Message Log to access this conversation's continue and finish methods.
  6. Invoke the setAlarm method. This starts the Timer control, which expires in 5 seconds. When the timer expires, it calls its onTimeout callback, which arrives at SimpleTimer via the timer_onTimeout callback handler. The timer_onTimeout callback handler in turn invokes SimpleTimer's onAlarm callback to the client.
  7. Refresh the browser to see callbacks arriving from the service. The use of a browser for Test View does not allow WebLogic Server to push notification to the browser when callbacks execute.
  8. Note: The setAlarm method uses the Timer control's restart method, so invoking setAlarm before the timer expires resets it so that it expires 5 seconds from the invocation of setAlarm.

  9. Refresh the browser periodically until the callback.onAlarm callback entry appears in the Message Log.
  10. Select log entries in the Message Log to see the message traffic involved in each interaction.

Related Topics

AdvancedTimer.jws Sample

Using WebLogic Built-In Controls

Timer Control

Designing Conversational Web Services

Using Callbacks to Notify Clients of Events

Testing Your Application with Test View