Hi Everybody,

I started using OpenEJB in Tomcat a couple weeks ago and now I'm facing a
problem.  My setup is pretty simple, I have a war file with 2 web services
in it.  Those web services are defined in web.xml and sun-jaxws.xml files. 
Now, what I want to do is to make those web services communicate with each
other.  I want my first web service to be able to call methods from my
second web service.  I added the @Stateless annotation to my web services
and made sur that both web services implemented an interface with the @Local
annotation.

>From what I read on the OpenEJB web site, the only thing I should have to do
is declare an instance of my second web service interface in my first web
service with the @EJB annotation and that's it.  But it doesn't work.

Here's my different classes/interface and how I use it.


ScoringServiceBean:

@Stateless
@WebService
public class ScoringServiceBean extends BaseService implements
IScoringServiceLocal
{
        
        @WebMethod
    @WebResult(name = "result", targetNamespace =
CommonConstants.TARGET_NAMESPACE)
        public void testMethod(@WebParam(name = "userId", targetNamespace =
CommonConstants.TARGET_NAMESPACE) int userId)
        {
                // code here............
        }
        
}


IScoringServiceLocal:

@Local
public interface IScoringServiceLocal 
{
        public void testMethod(@WebParam(int userId);
}



UserServiceBean:

@Stateless
@WebService
public class UserServiceBean extends BaseService implements
IUserServiceLocal 
{
        @EJB
        private IScoringServiceLocal scoringBean;
        
        
        
        @WebMethod
    @WebResult(name = "result", targetNamespace =
CommonConstants.TARGET_NAMESPACE)
        public void updateUserProfil(
                        @WebParam(name = "credentials", targetNamespace =
CommonConstants.TARGET_NAMESPACE) CredentialsDTO credentials,
                        @WebParam(name = "user", targetNamespace =
CommonConstants.TARGET_NAMESPACE) User user)
        throws ServiceException
        {
                // my code here......
        }
}


IUserServiceLocal :

@Local
public interface IUserServiceLocal 
{
        public void updateUserProfil(CredentialsDTO credentials, User user);
}




When I call UserServiceBean method through SoapUI, the reference to
ScoringServiceBean is always null.  I read a lot at different places to find
out what was missing, but I cant find out.  I read on pom.xml file,
ejb-jar.xml file, but it is cleared stated at
http://openejb.apache.org/3.0/tomcat.html that the only thing I'm supposed
to do is add annotations and everything should work.

Can someone help me please??  Is there something missing in my setup?  Do I
have to declare ejb definition somewhere??  Web.xml? context.xml?

Thank you very much for your help,
Phil

-- 
View this message in context: 
http://openejb.979440.n4.nabble.com/EJB-injection-in-Tomcat-web-service-tp3021240p3021240.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to