补充:VBScript调用webService
<SCRIPT language="JavaScript">
// Client invoke WebService use HTTP POST request and response
function GetHelloWorld_HTTPPOST(i)
{
var URL = "
http://localhost/WSInvoke/Service1.asmx/HelloWorld";" target="_new">
http://localhost/WSInvoke/Service1.asmx/HelloWorld";
var Params = "i=" + i;// Set postback parameters
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("POST",URL, false);
xmlhttp.SetRequestHeader ("Content-Type","application/x-www-form-urlencoded");
xmlhttp.SetRequestHeader ("Content-Length",Params.length);
xmlhttp.send(Params);
var x = xmlhttp.responseXML;
alert(x.childNodes[1].text);
//那么如何知道是否调用成功呢,状态为200说明调用成功,500则说明出错
alert(xmlhttp.Status);
alert(xmlhttp.StatusText);
}
</SCRIPT>
<SCRIPT language="vbscript">
' Client invoke WebService use HTTP POST request and response
Function vbGetHelloWorld_HTTPPOST(i)
URL = "
http://localhost/WSInvoke/Service1.asmx/HelloWorld"
Params = "i=" & i ' Set postback parameters
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "POST",URL,False
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "Content-Length",LEN(Params)
xmlhttp.Send(Params)
Set x = xmlhttp.responseXML
alert(x.childNodes(1).text)
'那么如何知道是否调用成功呢,状态为200说明调用成功,500则说明出错
alert(xmlhttp.Status)
alert(xmlhttp.StatusText)
Set xmlhttp = Nothing
End Function
</SCRIPT>