APIGee正在将请求迁移到TLS 1.2
操作系统:Windows Server 2003 !!!
我在vb6中开发了一个旧应用程序,但由于此新迁移而停止工作
这是我的代码
Public Function GetCustomerName(ByVal pCPFCliente As String) As String
Dim xmlhttp As MSXML2.ServerXMLHTTP
Set xmlhttp = New MSXML2.ServerXMLHTTP
xmlhttp.Open "GET", const_URL & "/customer=" & pCPFCliente & "&identification.type=CPF", False
xmlhttp.setRequestHeader "Content-Type", "application/json"
xmlhttp.setRequestHeader "Authorization", const_TOKEN
xmlhttp.send
Dim objJson As Object
Set objJson = JSON.parse(xmlhttp.responseText)
Dim lacoRecord As Integer
Dim customerName As String
customerName = ""
If xmlhttp.Status = 200 Then
For lacoRecord = 1 To objJson.Item("records").Count
customerName = objJson.Item("records")(lacoRecord).Item("name")
Next
ElseIf xmlhttp.Status = 404 Then
If objJson.Item("errorCode") = 20023 Then
Call WriteLogManual("CONSULTA CPF", "Cliente não encontrado! " & pCPFCliente, pPedido, 0, 0, 0, 0, 0)
Else
Call WriteLogManual("CONSULTA CPF", "Erro ao consultar CPF " & pCPFCliente & " - " & xmlhttp.responseText, pPedido, 0, 0, 0, 0, 0)
End If
ElseIf xmlhttp.Status = 503 Then
MsgBox "Ocorreu um erro 503 ao buscar o CPF do Cliente na API. " & Chr(13) & xmlhttp.responseText
Call WriteLogManual("CONSULTA CPF", "Erro ao consultar saldo na ApiGee - " & xmlhttp.responseText, pPedido, 0, 0, 0, 0, 0)
Else
MsgBox "Ocorreu um erro ao buscar o saldo do Cliente na API. " & Chr(13) & xmlhttp.responseText
Call WriteLogManual("CONSULTA CPF", "Erro ao consultar saldo na ApiGee - " & xmlhttp.responseText, pPedido, 0, 0, 0, 0, 0)
End If
GetCustomerName = customerName
End Function
答案 0 :(得分:0)
为了使用更新的TLS协议,需要更新Windows上的基础WinHTTP服务。这确实不是VB6特有的,它适用于所有在Windows上使用WinHTTP库的应用程序。
Microsoft在KB 3140245中具有将更新应用于Windows 7,Windows Server 2008 R2和Windows Server 2012的说明。还必须更新注册表中的DefaultSecureProtocols值,以默认情况下启用TLS 1.2(和其他所需版本)。
如果您使用的是Windows的较旧版本,the WinHTTP library doesn't support TLS newer than 1.0(并且由于您不再获得操作系统的安全更新,那可能就是您最少的担心)。您需要使用其他一些HTTPS库,这些库不使用基础的OS Schannel库来处理其加密,尽管我不知道有什么东西容易随便集成到VB6中。将服务器升级到受支持的Windows版本可能是最简单的方法。