B4J Question HttpJob B4X Difference with .NET ?

Magma

Expert
Licensed User
Longtime User
Hi there.....

I have here my code:
B4X:
public Sub RequestSalesPayment(sessionId As String, terminal_id1 As String, cashregister_id As String, amount As Int, currencyCode As Int, merchantnotes As String, customernotes As String, preauthbool As String,maxInstalments As Int, tipamount As Int) As ResumableSub
  
    If gottoken=False Then
        Log($"Sorry, not having "access_token" to continue at RequestSalesPayment..."$)
        Return False
    End If
  
    Private j As HttpJob
    j.Initialize("viva",Me)
  
    j.postString(usingurl & "transactions:sale",$"{"sessionId": "${sessionId}","terminalId": ${terminal_id1},"cashRegisterId": "${cashregister_id}","amount": ${amount.As(String)},"currencyCode": ${currencyCode.as(String)},"merchantReference": "${merchantnotes}","customerTrns": "${customernotes}","preauth": ${preauthbool},"maxInstalments": ${maxInstalments.as(String)},"tipAmount": ${tipamount.as(String)}}"$) 'amount 0.30...
    j.GetRequest.SetHeader("Authorization", "Bearer " & access_token)
    j.GetRequest.Setheader("Accept", "application/json")
    J.GetRequest.SetContentType("application/json")
    Wait For (j) JobDone(j As HttpJob)
    'Log(j.GetString)
    If j.Success=True Then
    If j.GetString.Contains("detail")=True Then
        j.release
        Log("This SessionID already used, use other and try again.")
        Return False
        Else
            Log(j.GetString)          
        j.release
        Log("Now you will probably check your POS after a while (because of cloud) - asking for credit/debit card.")
        Return True
    End If
    Else
        j.Release
        Return False
    End If

End Sub


and this the code of vb .net created from a partner (based ony my code):
B4X:
        Public Async Function RequestSalesPayment(sessionId As String, terminalId1 As String, cashRegisterId As String, amount As Integer, currencyCode As Integer, merchantNotes As String, customerNotes As String, preauthBool As String, maxInstallments As Integer, tipAmount As Integer) As Task(Of Boolean)
            If Not _gotToken Then
                Debug.WriteLine("Sorry, not having access_token to continue at RequestSalesPayment...")
                Return False
            End If

            Dim jsonContent As String = $"{{""sessionId"": ""{sessionId}"",""terminalId"": ""{terminalId1}"",""cashRegisterId"": ""{cashRegisterId}"",""amount"": {amount},""currencyCode"": {currencyCode},""merchantReference"": ""{merchantNotes}"",""customerTrns"": ""{customerNotes}"",""preauth"": {preauthBool},""maxInstallments"": {maxInstallments},""tipAmount"": {tipAmount}}}"
            Dim content As New StringContent(jsonContent, Encoding.UTF8, "application/json")

            httpClient.DefaultRequestHeaders.Authorization = New Headers.AuthenticationHeaderValue("Bearer", AccessToken)

            Dim response = Await httpClient.PostAsync(_usingUrl & "transactions:sale", content)
            Dim result = Await response.Content.ReadAsStringAsync()

            If response.IsSuccessStatusCode Then
                If result.Contains("detail") Then
                    Debug.WriteLine("This SessionID already used, use another and try again.")
                    Return False
                Else
                    Debug.WriteLine("Now you will probably check your POS after a while (because of cloud) - asking for credit/debit card.")
                    Return True
                End If
            Else
                Return False
            End If
        End Function

My code works ok when POS is not having locked keyboard (ticking at EFTPOS Greek IRS AADE) - not working when tick
Code of friend works ok when POS anytime (ticking at EFTPOS Greek IRS AADE) <---that i need to do with my code too...

Running the code taking the same responses... but the value/price going at locked machine when using .NET code... with my code not...
Am i having some encoding problem or something can't found - any idea ?

Going to be crazy !!!

My class is here...
 
Last edited:
Solution
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Maybe related to the certificate or https.
Since you said it is a local device, does it have a secure certificate installed?
Does http work?

If it does have an ssl or https then try adding HU2_ACCEPTALL to Conditional Symbols in Build Configurations (Ctrl+B).

Magma

Expert
Licensed User
Longtime User
??
Send a POST-Request to the right URL. The URL you probably get in your account. Live/Demo Environment
no ...

1714057250859.png
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
but....

how... ?
B4X:
public Sub LocalRequestSalesPayment(iptopost As String,  sessionid As String, amount As Int) As ResumableSub
   
   
    Private j As HttpJob
    j.Initialize("viva",Me)
    j.postString(iptopost & "/pos/v1/sale",$"{"sessionId": "${sessionid}", "amount": ${amount.As(String)}}"$)
    'j.GetRequest.SetHeader("Authorization", "Bearer " & access_token)
    'j.GetRequest.Setheader("Accept", "application/json")
    J.GetRequest.SetContentType("application/json")
    Wait For (j) JobDone(j As HttpJob)
    'Log(j.GetString)
    If j.Success=True Then
    If j.GetString.Contains("detail")=True Then
        j.release
        Log("This SessionID already used, use other and try again.")
        Return False
        Else           
            Log(j.GetString)
        j.release
        'Log("Now you will probably check your POS after a while (because of cloud) - asking for credit/debit card.")

        Return True
    End If
    Else
        j.Release
        Return False
    End If

End Sub


Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
javax.net.ssl.SSLException: Read timed out
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:325)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:268)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:140)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1462)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1370)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:437)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:175)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(OkHttpClientWrapper.java:172)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(OkHttpClientWrapper.java:220)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:982)
at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:457)
at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:165)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:109)
... 28 more
ResponseError. Reason: javax.net.ssl.SSLException: Read timed out, Response:
false

ps: sorry Erel for fast json text string :) and not using the proper way
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Check their documentation. The must be a URL and a port listed somewhere there.

Or in your ACCOUNT. the link you posted is only a link to the example in the docs. The URL must be available somewhere. I can´t help on getting the right URL.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Upvote 0

Magma

Expert
Licensed User
Longtime User
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This API Documentation details peer-to-peer communication, enabling calls between ECR systems and EFT POS (card terminal) devices on the same network. With this feature, you can initiate transactions and exchange data by addressing the IP address of an EFT POS device through our REST API service.

Maybe you have a Port setting in the EFT POS Device?

Use the device IP Address and the Port in the REST Call
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
....there is an option... at softpos... enabling Peer to Peer... enabled that... and gave me different port....

also getting different log error !:

Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:325)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:268)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:645)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:464)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:360)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:445)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:423)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:167)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1462)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1370)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:437)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:175)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(OkHttpClientWrapper.java:172)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(OkHttpClientWrapper.java:220)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
at java.base/sun.security.validator.Validator.validate(Validator.java:264)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:629)
... 35 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
... 40 more
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, Response:
false
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Wait For (a.RequestSalesPayment("no_of_invoice-try27",a.terminal_id,"YOURCASHIERSERIAL001",30,978,"test...","test...", False,0,0)) complete (success As Boolean)
I can say this is a bad practice. It is hard to read and you may accidentally passing the wrong argument.
Can you modify it to pass the json as argument?

B4X:
Sub RequestSalesPayment (json As String)

End Sub

Edit: or pass it as a Map.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
I can say this is a bad practice. It is hard to read and you may accidentally passing the wrong argument.
Can you modify it to pass the json as argument?

B4X:
Sub RequestSalesPayment (json As String)

End Sub

Edit: or pass it as a Map.
ok - i am editing it :)
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
I can say this is a bad practice. It is hard to read and you may accidentally passing the wrong argument.
Can you modify it to pass the json as argument?

B4X:
Sub RequestSalesPayment (json As String)

End Sub

Edit: or pass it as a Map.


I know you are not going to sleep if not edit that... so here you are..

B4X:
public Sub LocalRequestSalesPayment(iptopost As String,  sessionid As String, amount As Int) As ResumableSub
    
    
    Private j As HttpJob
    j.Initialize("viva",Me)

    Dim m As Map = CreateMap("sessionId": sessionid, "amount": amount)
    Dim json As String = m.As(JSON).ToString

    j.postString(iptopost & "/pos/v1/sale",json) 

    J.GetRequest.SetContentType("application/json")

    Wait For (j) JobDone(j As HttpJob)

    If j.Success=True Then

        Log(j.GetString)
        j.release

        Return True

    Else
        j.Release
        Return False
    End If

End Sub

but i have the same PKIX error...
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I know you are not going to sleep if not edit that... so here you are..
Hope you would have sweet dream too...

B4X:
Public Sub RequestSalesPayment (Url As String, Data As Map, AccessToken As String) As ResumableSub
    Dim success As Boolean
    Dim j As HttpJob
    j.Initialize("", Me)
    j.PostString(Url & "/pos/v1/sale", Data.As(JSON).ToString)
    j.GetRequest.SetHeader("Authorization", "Bearer " & AccessToken)
    'j.GetRequest.Setheader("Accept", "application/json")
    J.GetRequest.SetContentType("application/json")
    
    ' DonManfred snippet
    J.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36")
    
    Wait For (j) JobDone (j As HttpJob)
    If j.Success Then
        Log(j.GetString)
        If j.GetString.Contains("detail") Then
            Log("This SessionID already used, use other and try again.")
        Else
            Log("Now you will probably check your POS after a while (because of cloud) - asking for credit/debit card.")
            success = True
        End If
    Else
        Log("There is an error")
        Log(j.ErrorMessage)
    End If
    j.Release
    Return success
End Sub
 

Attachments

  • VivaEcrApi.zip
    10.1 KB · Views: 75
Upvote 0

aeric

Expert
Licensed User
Longtime User
By using Map, you can easily commented the unnecessary lines of code.

B4X:
Dim pmt As Map
pmt.Initialize
pmt.Put("sessionId", "4bdebe62-c211-4ca0-a994-b2fbea2061c5")
pmt.Put("terminalId", "16000010")
pmt.Put("cashRegisterId", "XDE384678UY")
pmt.Put("amount", 1170)
pmt.Put("currencyCode", "978")
pmt.Put("merchantReference", "some-reference")
pmt.Put("customerTrns", "some-reference")
pmt.Put("preauth", False)
pmt.Put("maxInstalments", 0)
pmt.Put("tipAmount", 0)
'pmt.Put("showTransactionResult", True)
'pmt.Put("showReceipt", True)
'pmt.Put("aadeProviderId", 999)
'pmt.Put("aadeProviderSignatureData", "AD33729F4ED749928AAFA00B90EE4EA91551BAC1;;20231204080313;1051;10000;2400;12400;POS_1")
'pmt.Put("aadeProviderSignature", "o0094r3Yk3KTqASLkW3evlDsnIg/ZAdUUf6UCXDtjqpI/dquzAT4WNX3yzS/GLciVNbT75H4pj8hLOV0EpHtzw==")
'pmt.Put("aadePreloaded", True)
'pmt.Put("aadePreloadedDuration", 13)

Dim a As Utility
a.Initialize
Wait For (a.RequestSalesPayment(usingurl, pmt, access_token)) Complete (Success As Boolean)
Log("RequestSalesPayment: " & Success)
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
well..

the same... access_token not something need for local... but remove or not... nothing different....

Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
Calling API...
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:325)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:268)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:263)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:645)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:464)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:360)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:445)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:423)
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:167)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1462)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1370)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:437)
at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379)
at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:175)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(OkHttpClientWrapper.java:172)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(OkHttpClientWrapper.java:220)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
at java.base/sun.security.validator.Validator.validate(Validator.java:264)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:629)
... 35 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
... 40 more
ResponseError. Reason: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, Response:
There is an error
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
RequestSalesPayment: false
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Maybe related to the certificate or https.
Since you said it is a local device, does it have a secure certificate installed?
Does http work?

If it does have an ssl or https then try adding HU2_ACCEPTALL to Conditional Symbols in Build Configurations (Ctrl+B).
 
Upvote 0
Solution

Magma

Expert
Licensed User
Longtime User
Maybe related to the certificate or https.
Since you said it is a local device, does it have a secure certificate installed?
Does http work?

If it does have an ssl or https then try adding HU2_ACCEPTALL to Conditional Symbols in Build Configurations (Ctrl+B).
It WORKEDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD!

needed HU2_ACCEPTALL (this not had it) with https (as i have it) - and worked !!!!!!!!!!!!!!!

not with first... first made clean project... and then worked..
 
Upvote 0
Top