我使用Exclipse webservice工具创建了soap web服务。我测试了webservice它的工作正常。自动装配在WebService类中不起作用。 我尝试通过在Web服务和使用@Post Construct中扩展SpringBeanAutowiringSupport类来解决此问题。
这是我的网络服务。
Mechanize::ResponseCodeError: 500 => Net::HTTPInternalServerError for https://sarathi.nic.in:8443/nrportal/sarathi/DlDetRequest.jsp -- unhandled response
这是LoginServiceInterface代码
require 'mechanize'
require 'logger'
require 'nokogiri'
require 'open-uri'
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
agent = Mechanize.new
agent.log = Logger.new "mech.log"
agent.user_agent_alias = 'Mac Safari 4'
Mechanize.new.get("https://sarathi.nic.in:8443/nrportal/sarathi/HomePage.jsp")
page=agent.get('https://sarathi.nic.in:8443/nrportal/sarathi/HomePage.jsp') # opening home page.
page = agent.page.links.find { |l| l.text == 'Status of Licence' }.click # click the link.
page.forms_with(:name=>"dlform").first.field_with(:name=>"dlform:DLNumber").value="TN38 20120001119" #user input to text field.
page.form_with(:name=>"dlform").field_with(:name=>"javax.faces.ViewState").value="SUBMIT" #submit button value assigning.
page.form(:name=>"dlform",:action=>"/nrportal/sarathi/DlDetRequest.jsp") #to specify the form i need.
agent.cookie_jar.clear!
gg=agent.submit page.forms.last #submitting my form
这是LoginServiceImpl Code
@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);
}
}
当我调用我的webService时,loginService始终为Null。我在下面的链接中提到过 JAX WS webservice does not take spring bean from applicationcontext, hence throws null pointer exception
我还面临着空指针Exception。请让我知道解决方案
当我尝试扩展SpringBeanAutowiringSupport类时,我收到了以下错误
@Service
public interface LoginService {
public boolean findValidUser(String userName,String password);
}