function RequestWebService() { var c = document.getElementById(‘UserName‘).value; var pwd = document.getElementById(‘UserPwd‘).value; var data; data = ‘<?xml version="1.0" encoding="utf-8"?>‘; data = data + ‘<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">‘; data = data + ‘<soap12:Body>‘; data = data + ‘<UKLogin xmlns="http://123.k.tlsw.net/" >‘; data = data + ‘<UkNo>‘ + c; data = data + ‘</UkNo>‘; data = data + ‘<UkPwd>‘ + pwd; data = data + ‘</UkPwd>‘; data = data + "</UKLogin>"; data = data + ‘</soap12:Body>‘; data = data + ‘</soap12:Envelope>‘; //创建异步对象 var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.Open("POST", "http://192.168.3.66:8001/UKWebService.asmx", false); xmlhttp.SetRequestHeader("Content-Type", "application/soap+xml"); xmlhttp.Send(data); var status = xmlhttp.status; if (status == 200) { var xmlData = xmlhttp.responseXML; var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = false; xmlDoc.loadXML(xmlhttp.responseText); xmlData = xmlDoc; var result = xmlData.text; //var result = xmlhttp.responseText; var aaa = decodeURIComponent(result); document.getElementById("data").innerHTML = aaa; var temp = eval(‘(‘ + aaa + ‘)‘); } }
时间: 2024-10-13 10:41:13