从Windows Server 2008发出请求时经典asp出错

时间:2012-08-28 14:07:30

标签: iis-7 asp-classic msxml

以下代码在Windows 7 IIS和Windows Server 2008中的经典asp中工作正常,它给出错误(如下所示)。

这是代码:

url = "https://api.test.credex.net:10001/merchant/xxxx/requests"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
postData = "" // some json formatted data
xmlhttp.open "POST", url, false
xmlhttp.setOption(2) = 13056
xmlhttp.setOption(3) = "/credex/credex_net_ext_bundle.pem"
xmlhttp.setRequestHeader "Content-Type", "application/json"
xmlhttp.setRequestHeader "Accept", "application/json"
xmlhttp.setRequestHeader "Authorization", "Basic "&Base64Encode("xxxxxxxx")
xmlhttp.send postData

Response.write xmlhttp.responseText     
set xmlhttp = nothing

错误:

  

类别:msxml3.dll
  栏目:-1
  简要说明:客户端和服务器无法通信,因为它们不具备通用算法。
  错误行no指向“xmlhttp.send postData”

1 个答案:

答案 0 :(得分:0)

在你的代码修改行

set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 

set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP.6.0") 

试试这个

<%@language=Jscript%>
<%
   var objSrvHTTP;
   var objXMLSend;
   var objXMLReceive;
   objSrvHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0");
   objXMLSend = Server.CreateObject("Msxml2.DOMDocument.6.0");
   objXMLReceive = Server.CreateObject("Msxml2.DOMDocument.6.0");

   objXMLSend.async = false;
   objXMLSend.loadXML ("<msg><id>2</id></msg>");

   objSrvHTTP.open ("POST","http://someotherserver/respond.asp",false);
   objSrvHTTP.send (objXMLSend);
   objXMLReceive = objSrvHTTP.responseXML;
   Response.ContentType = "text/xml";
   Response.Write (objXMLReceive.xml);
%>