我在使用jQuery从SOAP服务器解析响应时遇到问题。
这是请求
POST /REMEDIFINDERSERVICES/HSWebService.asmx HTTP/1.1
Host: 192.168.1.24
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.healthsprint.com/NewUserRegistration"
<?xml version="1.0" encoding="utf-8"?>
<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>
<NewUserRegistration xmlns="http://www.healthsprint.com">
<loginId>string</loginId>
<Password>string</Password>
</NewUserRegistration>
</soap:Body>
</soap:Envelope>
这是回复
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<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>
<NewUserRegistrationResponse xmlns="http://www.healthsprint.com">
<NewUserRegistrationResult>int</NewUserRegistrationResult>
</NewUserRegistrationResponse>
</soap:Body>
</soap:Envelope>
这是我的代码
$("#signup_btn").click(function (event) {
var fornewUrl = "http://192.168.1.24/REMEDIFINDERSERVICES/HSWebService.asmx?op=NewUserRegistration";
var newforsoapRequest =
'<?xml version="1.0" encoding="utf-8"?> \
<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> \
<NewUserRegistration xmlns="http://www.healthsprint.com"> \
<loginId>' + $(".user").val() + '</loginId> \
<Password>' + $(".pwd").val() + '</Password> \
</NewUserRegistration> \
</soap:Body> \
</soap:Envelope>';
$.ajax({
type: "POST",
url: fornewUrl,
contentType: "text/xml",
dataType: "xml",
data: newforsoapRequest,
success: newprocessSuccess,
error: newprocessError
});
function newprocessSuccess(data, status, req) {
if (status == "success")
$(".u_name").text($(req.responseXML).find("loginId").text());
}
function newprocessError(data, status, req) {
alert(req.responseText + " " + status);
}
});
我需要将数据发送到登录ID和密码,并且需要将登录ID显示到其他页面,但不知何故它在这里不起作用。
即使我将如何检查数据是否已发送到网络服务
提前致谢