When performing a simple GET to a remote host, I get the following. My code has been used many times before with other remote sites. Constructing the identical request in PostMan works fine. Any idea what is causing this?
(Http client initialized with accept all option.)
java.net.ProtocolException: Too many follow-up requests: 21
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:127)
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:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
This gets thrown (by OkHttp, not Retrofit) when there are more than 20 redirects when calling an endpoint. Usually this indicates a redirect cycle between two endpoints. Both Chrome and Firefox will also stop loading the request after this many redirects and fail the request.
You need to consult with your server team or endpoint documentation to ensure you are passing the correct data directly to the endpoint you want to call. No action for Retrofit to take here.
It is more like a server side auhentication problem enter you in redirect loop.
Postman success, so check all headers are set and sent using okhttp properly.
Step 1: Add to build configuration (Ctrl + B): HU2_PUBLIC Step 2: Add to starter service: Sub Service_Create Dim jo As JavaObject = HttpUtils2Service.hc Dim builder As JavaObject = jo.RunMethod("sharedInit", Array("hc")) builder.RunMethod("followRedirects", Array(False))...
Thanks for the replies. My problem is fixed. My original code was emulating user login using name and password to a remote host. Someone there activated single sign on and so I was giving the (originally correct) input to the completely wrong dialog. Hence the flood of responses.
Hence the flood.
So the real answer was "You need to consult with your server team or endpoint documentation to ensure you are passing the correct data directly to the endpoint you want to call."