Chúng tôi sử dụng lệnh gọi API web tới UPS để kiểm tra thông tin địa chỉ. Họ đang yêu cầu TLS 1.2 và công tắc đã phá vỡ trang của chúng tôi.Classic ASP Outbound TLS 1.2
<%
If ACTION="Verify" and ncSCountry="USA" and ncSState<>"PR" and ncSState<>"AA" and ncSState<>"AP" and ncSState<>"AE" then
Dim sXML
sXML = "<?xml version='1.0'?>"
sXML = sXML & "<AccessRequest xml:lang='en-US'>"
sXML = sXML & "<AccessLicenseNumber>XXXXXX</AccessLicenseNumber>"
sXML = sXML & "<UserId>XXXX</UserId>"
sXML = sXML & "<Password>XXXX</Password>"
sXML = sXML & "</AccessRequest>"
sXML = sXML & "<?xml version='1.0'?>"
sXML = sXML & "<AddressValidationRequest xml:lang='en-US'>"
sXML = sXML & "<Request>"
sXML = sXML & "<TransactionReference>"
sXML = sXML & "<CustomerContext /><XpciVersion>1.0001</XpciVersion>"
sXML = sXML & "</TransactionReference>"
sXML = sXML & "<RequestAction>XAV</RequestAction>"
sXML = sXML & "<RequestOption>1</RequestOption></Request>"
sXML = sXML & "<MaximumListSize>1</MaximumListSize>"
sXML = sXML & "<AddressKeyFormat>"
sXML = sXML & "<ConsigneeName></ConsigneeName>"
sXML = sXML & "<BuildingName></BuildingName>"
sXML = sXML & "<AddressLine>" & ncSAddr1 & "</AddressLine>"
sXML = sXML & "<AddressLine>" & ncSAddr2 & "</AddressLine>"
sXML = sXML & "<AddressLine></AddressLine>"
sXML = sXML & "<PoliticalDivision2>" & ncSCity & "</PoliticalDivision2>"
sXML = sXML & "<PoliticalDivision1>" & ncSState & "</PoliticalDivision1>"
sXML = sXML & "<PostcodePrimaryLow>" & ncSZip & "</PostcodePrimaryLow>"
sXML = sXML & "<CountryCode>US</CountryCode>"
sXML = sXML & "</AddressKeyFormat>"
sXML = sXML & "</AddressValidationRequest>"
'Now pass the request to UPS
Dim xmlhttp4, sResponseXML, myDoc
Set xmlhttp4 = CreateObject("WinHttp.WinHttpRequest.5.1")
'Set xmlhttp4 = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp4.Open "POST","https://onlinetools.ups.com/ups.app/xml/XAV", false
xmlhttp4.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp4.send(sXML)
If xmlhttp4.Status >= 400 And xmlhttp4.Status <= 599 Then
'Response.Write("Error Occurred : " & xmlhttp.Status & " - " & xmlhttp.statusText)
sResponseXML = "</empty>"
Else
sResponseXML = xmlhttp4.responseText
End If
Set myDoc=CreateObject("Microsoft.XMLDOM")
myDoc.loadXML(sResponseXML)
myDoc.async = false
Dim addressline, addressline2, city, state, zip, zip4, responsestatus
Dim root, NodeList, x
Set root = myDoc.DocumentElement
If myDoc.hasChildNodes then
Set NodeList = root.SelectNodes("AddressKeyFormat")
For x = 0 To (NodeList.Length - 1)
city = NodeList.Item(x).SelectSingleNode("PoliticalDivision2").Text
state = NodeList.Item(x).SelectSingleNode("PoliticalDivision1").Text
addressline = NodeList.Item(x).SelectSingleNode("AddressLine").Text
addressline2=NodeList.Item(x).SelectSingleNode("AddressLine").NextSibling.nodename
if addressline2="AddressLine" then
addressline2=NodeList.Item(x).SelectSingleNode("AddressLine").NextSibling.Text
Else
addressline2=""
ENd if
zip = NodeList.Item(x).SelectSingleNode("PostcodePrimaryLow").Text
zip4 = NodeList.Item(x).SelectSingleNode("PostcodeExtendedLow").Text
Next
End If
Dim startcust3, endcust3
startcust3=instr(sresponseXML, "<ResponseStatusCode>")
endcust3 = instr(sresponseXML, "</ResponseStatusCode>")
responsestatus=Mid(sResponseXML,startcust3+20,(endcust3-startcust3-20))
ENd if
%>
Tôi đã cố gắng thực hiện chuyển đổi này, nhưng tôi cảm thấy mình đang thiếu thứ gì đó.
Set xmlhttp4 = CreateObject("WinHttp.WinHttpRequest.5.1")
'Set xmlhttp4 = CreateObject("MSXML2.ServerXMLHTTP")
Hãy thử xem xét các câu trả lời trong bài viết SO này: http://stackoverflow.com/q/29127018/964043 – dmarietta
Bạn đã thử đặt bất kỳ ứng dụng HTTP nào bạn đang sử dụng để sử dụng TLS 1.2? Tôi đã đọc xung quanh rằng nó có thể yêu cầu .NET 4.5+ http://stackoverflow.com/questions/4137106/are-there-net-implementation-of-tls-1-2 – mmcrae