2012-08-28 107 views
0

下面的代碼在windows 7 IIS和windows server 2008中的經典asp中正常工作,它給出錯誤(如下所示)。在從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 

錯誤:

Category : msxml3.dll
Column : -1
Brief Description : The client and server cannot communicate, because they do not possess a common algorithm.
Error line no is pointed to "xmlhttp.send postData"

回答

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); 
%> 
相關問題