13:12:23.142 System.out I HttpClient: RESPONSE: -1 Unknown Status Code
13:12:23.142 System.out I METHOD: HttpMethod(value=POST)
13:12:23.142 System.out I FROM: https://webservice.azurewebsites.net/en/Dispatch/getTickets
13:12:23.142 System.out I COMMON HEADERS
13:12:23.142 System.out I -> content-length: 0
13:12:23.142 System.out I -> date: Wed, 25 Sep 2024 07:42:23 GMT
13:12:23.142 System.out I -> server: Microsoft-IIS/10.0
13:12:23.142 System.out I -> set-cookie: ARRAffinity=6dec0997e21dec30ce7ef102ebaec80934d28e2723296e23b047a25a64c195a9;Path=/;HttpOnly;Secure;Domain=webservice.azurewebsites.net; ARRAffinitySameSite=6dec0997e21dec30ce7ef102ebaec80934d28e2723296e23b047a25a64c195a9;Path=/;HttpOnly;SameSite=None;Secure;Domain=webservice.azurewebsites.net
13:12:23.142 System.out I -> www-authenticate: Bearer error="invalid_token", error_description="The token expired at '09/25/2024 07:22:35'"
13:12:23.142 System.out I -> x-android-received-millis: 1727250143135
13:12:23.142 System.out I -> x-android-response-source: NETWORK 401
13:12:23.142 System.out I -> x-android-selected-protocol: http/1.1
13:12:23.142 System.out I -> x-android-sent-millis: 1727250142738
13:12:23.142 System.out I -> x-powered-by: ASP.NET
13:12:23.142 System.out I BODY Content-Type: null
13:12:23.142 System.out I BODY START
13:12:23.142 System.out I
13:12:23.142 System.out I BODY END
Expected response body of the type 'class app.models.Response' but was 'class io.ktor.utils.io.ByteBufferChannel'
In response from `https://webservice.azurewebsites.net/en/Dispatch/getTickets`
Response status `-1 Unknown Status Code`
Response header `ContentType: null`
Request header `Accept: application/json`
You can read how to resolve NoTransformationFoundException at FAQ:
https://ktor.io/docs/faq.html#no-transformation-found-exception
io.ktor.client.call.NoTransformationFoundException: Expected response body of the type 'class app.models.Response' but was 'class io.ktor.utils.io.ByteBufferChannel'
In response from `https://webservice.azurewebsites.net/en/Dispatch/getTickets`
Response status `-1 Unknown Status Code`
Response header `ContentType: null`
Request header `Accept: application/json`
You can read how to resolve NoTransformationFoundException at FAQ:
https://ktor.io/docs/faq.html#no-transformation-found-exception
at io.ktor.client.call.HttpClientCall.bodyNullable(HttpClientCall.kt:94)
at app.service.WebService$DispatchService.getTickets(WebService.kt:1088)
at app.service.WebService$DispatchService$getTickets$1.invokeSuspend(Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Он не появится из-за истечения срока действия токена. Я попытался сбросить токен, как показано ниже, вручную обработав код состояния -1. Но проблема не решена.
Ниже приведен журнал ответов, который я иногда получаю при вызове API. [code]13:12:23.142 System.out I HttpClient: RESPONSE: -1 Unknown Status Code 13:12:23.142 System.out I METHOD: HttpMethod(value=POST) 13:12:23.142 System.out I FROM: https://webservice.azurewebsites.net/en/Dispatch/getTickets 13:12:23.142 System.out I COMMON HEADERS 13:12:23.142 System.out I -> content-length: 0 13:12:23.142 System.out I -> date: Wed, 25 Sep 2024 07:42:23 GMT 13:12:23.142 System.out I -> server: Microsoft-IIS/10.0 13:12:23.142 System.out I -> set-cookie: ARRAffinity=6dec0997e21dec30ce7ef102ebaec80934d28e2723296e23b047a25a64c195a9;Path=/;HttpOnly;Secure;Domain=webservice.azurewebsites.net; ARRAffinitySameSite=6dec0997e21dec30ce7ef102ebaec80934d28e2723296e23b047a25a64c195a9;Path=/;HttpOnly;SameSite=None;Secure;Domain=webservice.azurewebsites.net 13:12:23.142 System.out I -> www-authenticate: Bearer error="invalid_token", error_description="The token expired at '09/25/2024 07:22:35'" 13:12:23.142 System.out I -> x-android-received-millis: 1727250143135 13:12:23.142 System.out I -> x-android-response-source: NETWORK 401 13:12:23.142 System.out I -> x-android-selected-protocol: http/1.1 13:12:23.142 System.out I -> x-android-sent-millis: 1727250142738 13:12:23.142 System.out I -> x-powered-by: ASP.NET 13:12:23.142 System.out I BODY Content-Type: null 13:12:23.142 System.out I BODY START 13:12:23.142 System.out I 13:12:23.142 System.out I BODY END [/code] После этого откроется журнал сбоев. [code]Expected response body of the type 'class app.models.Response' but was 'class io.ktor.utils.io.ByteBufferChannel' In response from `https://webservice.azurewebsites.net/en/Dispatch/getTickets` Response status `-1 Unknown Status Code` Response header `ContentType: null` Request header `Accept: application/json`
You can read how to resolve NoTransformationFoundException at FAQ: https://ktor.io/docs/faq.html#no-transformation-found-exception io.ktor.client.call.NoTransformationFoundException: Expected response body of the type 'class app.models.Response' but was 'class io.ktor.utils.io.ByteBufferChannel'
In response from `https://webservice.azurewebsites.net/en/Dispatch/getTickets` Response status `-1 Unknown Status Code` Response header `ContentType: null` Request header `Accept: application/json`
You can read how to resolve NoTransformationFoundException at FAQ: https://ktor.io/docs/faq.html#no-transformation-found-exception at io.ktor.client.call.HttpClientCall.bodyNullable(HttpClientCall.kt:94) at app.service.WebService$DispatchService.getTickets(WebService.kt:1088) at app.service.WebService$DispatchService$getTickets$1.invokeSuspend(Unknown Source:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) [/code] Он не появится из-за истечения срока действия токена. Я попытался сбросить токен, как показано ниже, вручную обработав код состояния -1. Но проблема не решена. [code]ResponseObserver { response -> if (response.status.value == -1 && response.contentType() == null ) { resetToken() } } [/code] Это исправляется только после перезапуска приложения Android. Как исправить это во время выполнения? Любая помощь будет оценена по достоинству.