KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sample > testCallEJBInWS_SampleWebServiceImpl


1 package sample;
2
3 import java.rmi.RemoteException JavaDoc;
4
5
6 /**
7  * This is the implementation bean class for the SampleWebService web service.
8  * Created 2.6.2005 15:26:52
9  * @author lm97939
10  */

11 public class SampleWebServiceImpl implements SampleWebServiceSEI {
12     
13     
14     // Enter web service operations here. (Popup menu: Web Service->Add Operation)
15
/**
16      * Web service operation
17      */

18     public String JavaDoc operation1() throws RemoteException JavaDoc {
19         // TODO implement operation
20
return lookupSampleSessionBean().sampleBusinessMethod();
21     }
22
23     /**
24      * Web service operation
25      */

26     public String JavaDoc operation2(String JavaDoc a, int b) throws java.lang.Exception JavaDoc, java.rmi.RemoteException JavaDoc {
27         // TODO implement operation
28
return null;
29     }
30
31     private sample.SampleSessionRemote lookupSampleSessionBean() {
32         try {
33             javax.naming.Context JavaDoc c = new javax.naming.InitialContext JavaDoc();
34             Object JavaDoc remote = c.lookup("java:comp/env/ejb/SampleSessionBean");
35             sample.SampleSessionRemoteHome rv = (sample.SampleSessionRemoteHome) javax.rmi.PortableRemoteObject.narrow(remote, sample.SampleSessionRemoteHome.class);
36             return rv.create();
37         }
38         catch(javax.naming.NamingException JavaDoc ne) {
39             java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
40             throw new RuntimeException JavaDoc(ne);
41         }
42         catch(javax.ejb.CreateException JavaDoc ce) {
43             java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ce);
44             throw new RuntimeException JavaDoc(ce);
45         }
46         catch(java.rmi.RemoteException JavaDoc re) {
47             java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,re);
48             throw new RuntimeException JavaDoc(re);
49         }
50     }
51 }
52
Popular Tags