i place in main
#AdditionalJar: slf4j-api-1.7.30
#AdditionalJar: sslcontext-android
and that is ok, but problem is this:
i write code:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Dim httpClient As OkHttpClient
Dim httpResponse As OkHttpResponse
Dim httpRequest As OkHttpRequest
Dim j As HttpJob
Dim out As OutputStream
End Sub
Private Sub Button1_Click
Dim GetEnviroment As String
httpClient.InitializeAcceptAll("httpClient")
'GetEnviroment = "/api/v3/attention"
'GetEnviroment = "/api/v3/environment-parameters"
'httpRequest.Timeout(20)
httpRequest.InitializeGet("
https://vsdc.sandbox.suf.purs.gov.rs" & GetEnviroment)
httpRequest.SetHeader("Content-Type", "application/json; charset=utf-8")
httpRequest.SetHeader("Accept", "application/json")
httpRequest.SetHeader("Accept-Language", "sr-Cyrl-RS")
httpRequest.SetHeader("PAC", "57MQ97")
httpClient.Execute(httpRequest, 1000)
End Sub
Sub hc_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
out.InitializeToBytesArray(0)
Response.GetAsynchronously("res", out, False, TaskId)
'xui.MsgboxAsync($"Error: ${out.}"$,"HELLO")
End Sub
Sub res_StreamFinish (Success As Boolean, TaskId As Int)
Log($" ${Success}"$)
If Success Then Log(BytesToString(out.ToBytesArray, 0, out.ToBytesArray.Length, "utf8"))
End Sub
Sub hc_ResponseError (Response As OkHttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Log($"Error: ${Response.ErrorResponse}, ${Reason}, ${StatusCode}"$)
If Response <> Null Then Response.Release
End Sub
for communication with API i need to send certificate to server "
https://vsdc.sandbox.suf.purs.gov.rs/api/v3/environment-parameters"
certificate is in attach. I must somehow read this certificate for communcation with this api.