Ati*_*tif 5 jquery soap web-services forms-authentication
我有一个Web服务,需要一个soap标头并返回一个身份验证令牌.我已设法使用jquery将soap标头发布到web服务.问题是如何使浏览器在每个Web服务授权请求上发送经过身份验证的令牌.你的帮助会很大.我使用的有用链接如下:参考:
码:
function logIn(username, password, token) {
var soapMessage =
'<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> \
<soap:Body> \
<SecuredWebServiceHeader xmlns="http://tempuri.org/"> \
<Username>' + username + '</Username> \
<Password>' + password + '</Password> \
<AuthenticatedToken>' + token + '</AuthenticatedToken> \
</SecuredWebServiceHeader> \
</soap:Body> \
</soap:Envelope>';
$.ajax({
url: "http://localhost/wstest/Service.asmx/AuthenticateUser",
type: "POST",
dataType: "xml",
data: soapMessage,
complete: endLogin,
contentType: "text/xml; charset=\"utf-8\""
});
return false;
}
function endLogin(xmlHttpRequest, status) {
alert(xmlHttpRequest.responseXML)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5520 次 |
| 最近记录: |