on 01-26-2010 5:13 PM
Hi,
I have a problem using web service client injection via the @WebServiceRef annotation. I am kind of a newcomer to Java EE 5 and EJB and all that, so please be patient if my questions are stupid... I have two projects (inside an EAR project), one dynamic web application and one EJB project. In the EJB project, I have imported a couple of WSDL files and created web service proxies from those. Then I created a stateless session bean, where I try to use the web services with this kind of annotation:
@WebServiceRef (name="ProductGroupService")
ProductGroupService pgService;
I know the services and annotatition works if I use them in a servlet in the web application, but I wanted to move them to the separate EJB project. Now, what I do is that I instantiate an object of the bean class from the web application and try to invoke a method that uses the web service. The problem is that no web service reference seems to have been injected, the variable (pgService in the example above) is null.
As I said, I'm pretty new to EJB, so this might be the wrong of using the bean class. I do know that the @WebServiceRef annotation has some limitations, e.g. that it can only be used in an EJB, a servlet and some other case. When is the web service injection supposed to take place in an EJB? Should I be able to just instantiate the object and use the web service references?
I can see the web service clients in NWA under SOA management -> Single Service Administration -> Proxies, and in the JNDI tree under Problem Management, so they seem to be deployed properly. I get no errors on deployment, and none are logged to the default trace when I instantiate the bean class.
Im using NWDS 7.1 EHP1 and NW CE 7.1
Best regards,
Erik Eriksson
Ok, so I managed to figure out for myself that I have to do a name lookup for the EJB class and get the object that way. I got the injection to work now.
/Erik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.