Bank.jws Sample

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

Sample Location

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

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebServices/security/roleBased/

Sample Source Code


01 /**
02  <p> The Bank web service is used in conjunction with the VeriCheck web service.
03  * VeriCheck calls the Bank service to verify that a given checking account has 
04  * enough money in it to cover a given check.</p>
05  
06  */
07 
08 package security.roleBased; 
09 
10 /**
11  * @common:target-namespace namespace="http://workshop.bea.com/Bank"
12  */
13 public class Bank implements com.bea.jws.WebService
14 
15 
16     public Callback callback;
17 
18     public interface Callback extends com.bea.control.ServiceControl
19     {
20         /**
21          * @jws:conversation phase="finish"
22          */
23         public void onResultComplete(String accountID, String resultMessage);
24     }
25 
26     /**
27      * @common:operation
28      * @jws:conversation phase="start"
29      * @jws:message-buffer enable="true"
30      */
31     public void doesAccountHaveSufficientBalance(String accountID, int amount)
32     {
33         callback.setUsername("weblogic");
34         callback.setPassword("weblogic");
35         if(amount > 1000)
36             callback.onResultComplete(accountID, "The account does not have sufficient balance.");
37         else
38             callback.onResultComplete(accountID, "The account has sufficient balance.");
39     }
40