使用MSXML2.ServerXMLHTTP.6.0

时间:2019-06-10 12:02:01

标签: asp.net iis xmlhttprequest

我正在尝试使用经典ASP在基于https的Web服务上发布帖子,并且它可以工作,但最奇怪的是有时(随机)返回错误:

“证书中的主机名无效或不匹配”

页面返回此错误后,经过一段时间(几分钟),它又开始正常运行,而无所事事。

Dim Result
Dim SoapRequest
Set SoapRequest = CreateObject("MSXML2.ServerXMLHTTP.6.0")

Dim myXML 
Set myXML = CreateObject("MSXML.DOMDocument")
myXML.Async=False
SoapRequest.Open "POST", sUrl, False
SoapRequest.setRequestHeader "Content-Type","text/xml; charset=utf-8"
SoapRequest.setRequestHeader "SOAPAction", """http://tempuri.org/" & sMethod & """"
SoapRequest.setRequestHeader "Authorization", "BASIC " & Base64Encode(Request.ServerVariables("AUTH_USER")&":"&Request.ServerVariables("AUTH_PASSWORD"))   

Dim DataToSend
DataToSend = GetEnvelop(sMethod, params)

SoapRequest.Send DataToSend

If myXML.load(SoapRequest.responseXML) Then
    Dim Node
    Set Node = myXML.documentElement.selectSingleNode("//" & sMethod & "Result")
    Result =  Node.Text

    Set Node = Nothing
Else
    Result =  getXML("Response", "1", "Error calling WebService: " & sUrl & ", WebMethod: " & sMethod & " xml response: " & SoapRequest.responseXML, "0")   
End If
Set SoapRequest = Nothing
Set myXML = Nothing

1 个答案:

答案 0 :(得分:0)

好吧,问题出在绑定,两个站点指向同一个域,所以平衡器有时使事情正常。希望现在一切正常! :))))