Skip to Content
0
Sep 11, 2014 at 05:35 AM

"service" is null @WebServiceRef

337 Views

Hello Experts,

I'm using '@WebServiceRef' in my Web Module.
Sometimes the 'service' object is null.

public class WsStaffMobile {
@WebServiceRef (name="WsAuthUserWebService") WsAuthUserService service;

public UserDetails getUserDetails(@WebParam(name = "userName") String userName, @WebParam(name = "password") String password) {
WsAuthUser port = service.getWsAuthUserPort();
UserDetails userDetails = port.getUserDetails(userName, password);
return userDetails;
}

As a workaround I'm using JNDI (from this thread: http://scn.sap.com/thread/1716058) and it's working but how can I use annotation and injection and reinitialize the object (if needed)?

J2EE version is 7.31 SP7.


Regards,
Omri