Sending the data through the POST request does not work
ErrorMessage: Failed to connect
Log: Status: 0
B4X:
Sub JobDone (Job As JobResult)
Log("*******************************")
Log("JobName: ", Job.JobName)
If Job.Success Then
Dim bc As ByteConverter
Log("Response: ", bc.SubString2(Job.Response, 0, Min(200, Job.Response.Length)))
If Job.JobName = "Example" Then
Dim buffer(300) As Byte
Dim raf As RandomAccessFile
raf.Initialize(buffer, True)
WriteBytes(raf, "{""id"":""61751246""")
WriteBytes(raf, "}")
HttpJob.Initialize("Example2")
' Dim Datos As String = JoinStrings (Array As String ("{""id"":""",61751246,"""}"))
Log("Datos: ",bc.SubString2(buffer, 0, raf.CurrentPosition))
' HttpJob.AddHeader("Content-Type", "application/x-www-form-urlencoded")
HttpJob.AddHeader("Content-Type", "application/json")
Log("stack: ", StackBufferUsage, ", buffer size:", raf.CurrentPosition)
HttpJob.Post("https://chatbot-dot-central-dot-red-amarilla.appspot.com/_ah/api/consultarServicioXidServicioUsuario", bc.SubString2(buffer, 0, raf.CurrentPosition))
' HttpJob.Post("https://www.b4x.com/print.php?key1=value1", "PostKey1=PostValue2&abc=def")
End If
Else
Log("ErrorMessage: ", Job.ErrorMessage)
Log("Status: ", Job.Status)
Log(Job.Response)
End If
End Sub
Private Sub WriteBytes(raf As RandomAccessFile, Data() As Byte)
raf.WriteBytes(Data, 0, Data.Length, raf.CurrentPosition)
End Sub
ErrorMessage: Failed to connect
Log: Status: 0