使用JavaScript的消费者Web服务
我正在尝试验证历史记录中的密码,该应用程序是用Java和Spring开发的,我的疑问是在恢复历史记录和比较我输入的密码时 我试图通过Ajax调用WebService密码来实现这一点,但在URL(我知道我必须输入WebService的名称)和数据中,我不知道输入什么(密码值?)。该函数称为isValidPassword 您可以在其中找到服务和方法的Java类:使用JavaScript的消费者Web服务,javascript,java,ajax,spring,web-services,Javascript,Java,Ajax,Spring,Web Services,我正在尝试验证历史记录中的密码,该应用程序是用Java和Spring开发的,我的疑问是在恢复历史记录和比较我输入的密码时 我试图通过Ajax调用WebService密码来实现这一点,但在URL(我知道我必须输入WebService的名称)和数据中,我不知道输入什么(密码值?)。该函数称为isValidPassword 您可以在其中找到服务和方法的Java类: @WebService(targetNamespace = "urn:idm.openiam.org/srvc/pswd/ser
@WebService(targetNamespace = "urn:idm.openiam.org/srvc/pswd/service", name = "PasswordWebService")
@XmlSeeAlso({ObjectFactory.class})
public interface PasswordWebService {
@WebMethod
@RequestWrapper(localName = "isPasswordValid", targetNamespace = "urn:idm.openiam.org/srvc/pswd/service", className = "es.sanitas.gid.client.meta.IsPasswordValid")
@ResponseWrapper(localName = "isPasswordValidResponse", targetNamespace = "urn:idm.openiam.org/srvc/pswd/service", className = "es.sanitas.gid.client.meta.IsPasswordValidResponse")
@WebResult(name = "return", targetNamespace = "")
public es.sanitas.gid.client.meta.PasswordValidationResponse isPasswordValid(
@WebParam(name = "pswd", targetNamespace = "")
es.sanitas.gid.client.meta.Password pswd
);
}
$(document).ready(function() {
//var pswd=0
var confpswd=0
var minLength="La contraseña debe tener al menos 12 caracteres"
var pwdEquals="Las contraseñas deben coincidir"
var checkHistoryPass="Su contraseña es válida y no se ha usado anteriormente"
$('#newPassword').keyup(function() {
pswd = $(this).val();
checkAllRules(pswd);
checkEquals(pswd,confpswd);
isValidPassword(pswd,confpswd)
enabledButton();
});
$('#newPasswordConfirm').keyup(function() {
confpswd = $(this).val();
checkAllRules(pswd,confpswd);
checkEquals(pswd,confpswd);
isValidPassword(pswd,confpswd)
enabledButton();
});
function isValidPassword(pswd, conf){
$.ajax({
url: "PasswordWebService",
data: pswd,
type: "POST",
dataType: "json",
contentType: "application/json",
success: function(data) {
console.log("SUCCESS: ", data);
},
error : function(e) {
console.log("ERROR: ", e);
},
done : function(e) {
console.log("DONE");
}
});
}
Javascript,其中包含要验证的规则:
@WebService(targetNamespace = "urn:idm.openiam.org/srvc/pswd/service", name = "PasswordWebService")
@XmlSeeAlso({ObjectFactory.class})
public interface PasswordWebService {
@WebMethod
@RequestWrapper(localName = "isPasswordValid", targetNamespace = "urn:idm.openiam.org/srvc/pswd/service", className = "es.sanitas.gid.client.meta.IsPasswordValid")
@ResponseWrapper(localName = "isPasswordValidResponse", targetNamespace = "urn:idm.openiam.org/srvc/pswd/service", className = "es.sanitas.gid.client.meta.IsPasswordValidResponse")
@WebResult(name = "return", targetNamespace = "")
public es.sanitas.gid.client.meta.PasswordValidationResponse isPasswordValid(
@WebParam(name = "pswd", targetNamespace = "")
es.sanitas.gid.client.meta.Password pswd
);
}
$(document).ready(function() {
//var pswd=0
var confpswd=0
var minLength="La contraseña debe tener al menos 12 caracteres"
var pwdEquals="Las contraseñas deben coincidir"
var checkHistoryPass="Su contraseña es válida y no se ha usado anteriormente"
$('#newPassword').keyup(function() {
pswd = $(this).val();
checkAllRules(pswd);
checkEquals(pswd,confpswd);
isValidPassword(pswd,confpswd)
enabledButton();
});
$('#newPasswordConfirm').keyup(function() {
confpswd = $(this).val();
checkAllRules(pswd,confpswd);
checkEquals(pswd,confpswd);
isValidPassword(pswd,confpswd)
enabledButton();
});
function isValidPassword(pswd, conf){
$.ajax({
url: "PasswordWebService",
data: pswd,
type: "POST",
dataType: "json",
contentType: "application/json",
success: function(data) {
console.log("SUCCESS: ", data);
},
error : function(e) {
console.log("ERROR: ", e);
},
done : function(e) {
console.log("DONE");
}
});
}