我正在使用Microsoft.XMLHTTP调用调用web服务:
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "/xxx/Converter.asmx/Convert", false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("conversionFolder=" + escape(conversionFolder));
if (xmlhttp.status == 200) {
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(xmlhttp.responseText);
... more stuff ...
return str;
}
else {
alert(xmlhttp.statusCode + " - " + xmlhttp.statusText);
}
Run Code Online (Sandbox Code Playgroud)
当我记得在本地web.config中添加HttpPost协议时,一切正常.
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<webServices>
<protocols>
<add name="HttpPost"/>
</protocols>
</webServices>
<compilation debug="false"></compilation>
</system.web>
<system.codedom>
</system.codedom>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not …Run Code Online (Sandbox Code Playgroud)