I have created soap web Service using Exclipse webservice tool.I have tested webservice its working fine. Autowiring is not working in WebService Class. I tried to resolve the issue by extending SpringBeanAutowiringSupport class in web Service and Using @Post Construct.
This is my web Service.
@Service
@WebService(targetNamespace = "http://webservice.csm.cms.hpe.com/",
endpointInterface = "com.hpe.cms.csm.webservice.AuthenticateUserSEI",
portName = "AuthenticateUserPort", serviceName = "AuthenticateUserService")
public class AuthenticateUser implements AuthenticateUserSEI{
@Autowired
public LoginService loginService;
public boolean findValidUser(String userName,String password)
{
return loginService.validateUser(userName,password);
}
}
This is LoginServiceInterface Code
@Service
public interface LoginService {
public boolean findValidUser(String userName,String password);
}
This is LoginServiceImpl Code
@Service
public class LoginServiceImpl implements LoginService {
@Autowired
private LoginDAO loginDao;
public boolean findValidUser(String userName,String password) {
System.out.println("Login DAO:- "+loginDao);
return loginDao.validateUser(userName,password);
}
When i invoke my webService loginService is always Null. I reffered below link JAX WS webservice does not take spring bean from applicationcontext, hence throws null pointer exception
Still i m facing the null pointer Exception. Please let me know the solution
When I tried extending SpringBeanAutowiringSupport class,i m getting following error
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type [com.hpe.cms.csm.services.LoginService] found for
dependency: expected at least 1 bean which qualifies as autowire candidate
for this dependency.