LuckyNumber.jws Sample

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

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/database/lucky_number_db/

Sample Source Code


01 package database.lucky_number_db;
02 
03 /**
04  <p>A simple web service that shows how to create an exposed method that
05  * returns a value.</p>
06  * @common:target-namespace namespace="http://workshop.bea.com/LuckyNumber"
07  */
08 public class LuckyNumber implements com.bea.jws.WebService
09 
10     /**
11      <p>Returns a lucky number to the client.</p>
12      
13      @return A random number between 1 and 20.
14      *
15      * @common:operation
16      */
17     public int getLuckyNumber()
18     {
19         return (int)(20.0 * Math.random());
20     }
21