0

下面的代码在 windows 7 IIS 中的经典 asp 中运行良好,在 windows server 2008 中它给出错误(如下所示)。

这是代码:

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
简要说明:客户端和服务器无法通信,因为它们没有共同的算法。
错误行号指向“xmlhttp.send postData”

4

1 回答 1

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);
%>
于 2012-08-28T18:11:25.857 回答