Я пытаюсь отправить объект JSON из приложения VB.NET (3.5 Framework).
Я использую этот код:
Private Function sendSMS()
Dim objHTTP As Object
Dim json As String
Dim result As String
Dim URL As String
json = fJSON()
objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "https://api.XXXXXXXXX.com/api/3.0/sms/send"
objHTTP.Open("POST", URL, False)
objHTTP.setRequestHeader("Content-type", "application/json")
objHTTP.send(json)
result = objHTTP.responseText
objHTTP = Nothing
End Function
Private Function fJSON() As String
fJSON = "{"
fJSON = fJSON & """api_key"":""XXXXXXXXXXXXXXXXXXX"","
fJSON = fJSON & """concat"":1,"
fJSON = fJSON & """fake"":1,"
fJSON = fJSON & """messages"":["
fJSON = fJSON & "{"
fJSON = fJSON & """from"":""SHOP"","
fJSON = fJSON & """to"":""3400000000"","
fJSON = fJSON & """text"":""LOREM IPSUM"""
fJSON = fJSON & "}]}"
End Function
Но я получаю эту ошибку в коде строки:
Код строки:
objHTTP.setRequestHeader("Content-type", "application/json")
Ошибка:
System.Runtime.InteropServices.COMException (0x80004005): Ошибка no especificado
Что не так?