Hi

This works:


  | @Remote @Stateless @WebService
  | public class CalculatorService1 implements Calculator {
  | 
  |     @WebMethod
  |     public int add(int a, int b) {
  |             Calculator c = new CalculatorImpl();
  |             int result = c.add( a, b );
  |             return result;
  |     }
  | }
  | 

But I want to create the Calculator using a Spring Bean description. The 
perfect place is @PostActivate like I did here:


  | @Remote @Stateless @WebService
  | public class CalculatorService2 implements Calculator {
  | 
  |     private static final String SPRING_FILE = "calc.xml";
  |     private static final String CALC_BEAN = "calculator";
  |     private Calculator c = null;
  |     private Log log;
  | 
  |     public CalculatorService2() {
  |             log = LogFactory.getLog( getClass() );
  |             log.info("Constructor");
  |     }
  |     
  |     @WebMethod
  |     public int add(int a, int b) {
  |             log.info("Request for adding " + a + " + " + b );
  |             int result = c.add( a, b );
  |             return result;
  |     }
  |     
  |     @PostActivate
  |     public void postActivate() {
  |             log.info("Post activate");
  |             InputStream is = 
getClass().getClassLoader().getResourceAsStream( SPRING_FILE );
  |             InputStreamResource isr = new InputStreamResource( is );
  |             XmlBeanFactory bf = new XmlBeanFactory( isr );
  |             c = (Calculator) bf.getBean( CALC_BEAN );
  |     }
  |     
  |     @PrePassivate
  |     public void prePassivate() {
  |             log.info("Pre passivate");
  |             c = null;
  |     }
  | }
  | 

But the method is never executed. I thought the WebService is wrapper for a 
SLSB, but it seems like not.

How could I fix the second code?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3941642#3941642

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3941642


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to