# EventRaiserTest.jws Sample

This topic inludes the source code for the EventRaiserTest.jws Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/ExtensionDevKit/ControlDevKit/ControlTest/featuresTests/

## Sample Source Code

`01 package featuresTests; 02 03 import com.bea.control.JwsContext; 04 import java.util.Date; 05 06 /* 07 * This web service uses the EventRaiser control. That control is designed 08 * to simply forward the onTimeout event it receives from a Timer control. 09 * 10 * To test the control, run the web service. When Test View appears, click 11 * the getStarted button, the click the refresh button until the response 12 * appears. The control is designed to respond after 5 seconds. 13 */ 14 public class EventRaiserTest implements com.bea.jws.WebService 15 { 16 public Callback callback; 17 18 /** @common:context */ 19 JwsContext context; 20 21 /** 22 * @common:control 23 */ 24 private controlEvents.EventRaiser eventRaiserControl; 25 26 /** 27 * This method tells the EventRaiser control to start its timer. 28 * 29 * @common:operation 30 * @jws:conversation phase="start" 31 */ 32 public void getStarted() 33 { 34 eventRaiserControl.startTimer(); 35 } 36 37 /* 38 * This code handles a callback exposed by the EventRaiser control. 39 * The onTimeout fired by EventRaiser's Timer control is simply 40 * forwarded through this callback. The value received by the 41 * callback is wrapped in a Date object and converted to a String 42 * for display in Test View. 43 */ 44 public void eventRaiserControl_backEndTimer_onTimeout(long arg0) 45 { 46 callback.onDone(new Date(arg0).toLocaleString()); 47 } 48 49 public interface Callback 50 { 51 /** 52 * @jws:conversation phase="finish" 53 */ 54 void onDone(String response); 55 } 56 }`