Hello, dear developers!
I'm having trouble understanding why the system stops receiving returns from the webservice.
I developed a procedure that I already run in another program. I'm redoing the program in B4J.
In the other system, I search for various balances in the webservice that, on average, take 60 seconds to return. In the worst cases, 120 seconds.
The same procedure in B4J simply stops receiving. It receives up to two returns and stops.
Exactly in this call "Wait For (JOB) JobDone(JOB As HttpJob)".
I put it like this, waiting, otherwise it would overload the server with dozens of calls.
So I thought it would be appropriate to make B4J wait for each request.
I have access to the server processing, the webservice, and I see it finish executing the request and return, but the project in B4J doesn't receive it.
Here's part of the process that makes the loop to call the webservice:
'Here is the procedure that executes the call.
Does anyone have any idea what I'm doing wrong?
I'm having trouble understanding why the system stops receiving returns from the webservice.
I developed a procedure that I already run in another program. I'm redoing the program in B4J.
In the other system, I search for various balances in the webservice that, on average, take 60 seconds to return. In the worst cases, 120 seconds.
The same procedure in B4J simply stops receiving. It receives up to two returns and stops.
Exactly in this call "Wait For (JOB) JobDone(JOB As HttpJob)".
I put it like this, waiting, otherwise it would overload the server with dozens of calls.
So I thought it would be appropriate to make B4J wait for each request.
I have access to the server processing, the webservice, and I see it finish executing the request and return, but the project in B4J doesn't receive it.
Here's part of the process that makes the loop to call the webservice:
B4X:
For CA = DateTime.GetYear(MI) To DateTime.GetYear(MF)
For M = 1 To 12
Dim DataRef As Long = DateUtils.SetDate(CA, M, 1) ' Primeiro dia do mês
' Dim UltimoDia As Long = DateUtils.AddPeriod(DataRef, DateUtils.Period.Create(0, 1, -1)) ' Último dia do mês
Dim UltimoDia As Long = DateUtils.AddPeriod(DataRef, PerioDoM) ' Último dia do mês
UltimoDia = DateUtils.AddPeriod(UltimoDia, PerioDoD) ' Último dia do mês
' Verifica se o mês está dentro do intervalo escolhido pelo usuário
If DataRef >= MI And UltimoDia <= MF Then
Dim fMes As String = DateTime.Date(UltimoDia) ' Formato correto para o WS
Status_Processo (1,"Requisitando saldo da data " & fMes)
' Enviar requisição para buscar os saldos do mês correspondente
Dim JsonRequisicao As String = jsCI.Replace("¡DATAFINAL¡", fMes)
AnoMes.Ano=CA
AnoMes.Mes=M
Log(CA & " - " & M)
'AQUI FAZ A CHAMADA AO PROCESSAMENTO
API_WK(JsonRequisicao, "Estoque/Estoque.svc/json/BuscarSaldos")
Wait For (JOB) JobDone(JOB As HttpJob)
Status_Processo (1,"Saldo recebido! Processando...")
Processa_Job(JOB)
JOB.Release
Sleep (5000)
Else
Log(CA & " - " & M)
End If
Next
Next
'Here is the procedure that executes the call.
B4X:
private Sub API_WK(Texto_da_Requisicao As String, Metodo_da_Requisicao As String)
Dim JOB As HttpJob
Dim Link_API As String=txWSWK.Text
JOB.Initialize("BuscaWK", Me)
JOB.PostString(Link_API & Metodo_da_Requisicao, Texto_da_Requisicao)
JOB.GetRequest.SetContentType("application/json")
JOB.GetRequest.SetContentEncoding("gzip, deflate")
JOB.GetRequest.Timeout = 240000 ' 4 minutos
End Sub
Does anyone have any idea what I'm doing wrong?