how to do --insecure on httpjob B4J

44 Views Asked by At
Sub GetDataFromApi(serverName As String, c_type As String, endpoint As String, token As String)
    server_name=serverName
    url_host=endpoint
    Dim http As HttpJob
    Dim client As OkHttpClient
    
    client.InitializeAcceptAll("MyUserAgent")
    http.Initialize("", Me)
    http.GetRequest.InitializeGet(endpoint)
    http.GetRequest.SetHeader("Authorization", token)
    http.GetRequest.SetHeader("Content-Type", c_type)
    http.GetRequest.Timeout=30000
    http.GetRequest.SetHeader("Connection", "close")
    http.GetRequest.SetHeader("User-Agent", "MyUserAgent")
    http.Download(endpoint)
    
    Wait For (http) JobDone(http As HttpJob)
    If http.Success Then
        Log(http.GetString)
    Else
        Log("Error: " & http.ErrorMessage)
    End If
    http.Release
End Sub

above is my code on retrieving the data from the API, but the problem is: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

in curl i can just use this command "--insecure" but with httpjob, i had no idea how to implement --insecure. anyone can help me on how to implement --insecure on httpjob, so that way this error can be passed? thanks in advance

0

There are 0 best solutions below