Android Question Adding CA Bundle for Http POST request

Sreepathy T L

Licensed User
I want to upload a file to https url along with some POST parameters:

Current Code:
    Dim j As HttpJob
    j.Initialize("j", Me)
    Dim fd As MultipartFileData
    fd.KeyName = "xxxxxxx"
    fd.Dir = File.DirInternal
    fd.FileName = "xxxxx.db"
    fd.ContentType = "application/octet-stream"
    j.GetRequest.Timeout = 0
    j.PostMultipart("", CreateMap("uid": "12345","authkey":
"abcdef","appver":"1"), Array(fd))
    ProgressDialogShow2("Uploading data. Please wait...",False)

Sub JobDone(job As HttpJob)
    If(job.JobName = "j")Then
        If job.Success Then
                Msgbox("Data uploaded successfully","Success")
            Msgbox("Error: " & job.ErrorMessage, "Error")
        End If
    End If
End Sub

Now I am getting this error

B4X: Trust anchor for certification path not found

at this line
   Msgbox("Error: " & job.ErrorMessage, "Error")

When I checked with openssl
openssl s_client -debug -connect -CAfile .\cacert.pem
it works successfully

cacert.pem is downloaded from

So ultimately it is the missing CA bundle in the https request which causes the error.

Question 1: How I can include the CA bundle in the application which will be used during https requests?

I saw the post
where Erel has suggested to use Http.InitializeAcceptAll which I think will override https verification. But I could not use it due to error
Unknown member initializeacceptall
since j is of type HttpJob.

Question 2: I could not find any example using HttpClient, HttpRequest & HttpResponse to send a post request with file upload. Can anyone please post a simple example?