Response with status code 200 OK but unable to fetch the response data which is JSON format
While implementing the library, I was trying to invoke single request and I get the response with status code as 200 OK but unable to fetch the response data which is JSON format. Need support to resolve this. May be I'm missing something..
The transport is ApacheHttpTransport and I'm making simple service GET call which will return a string.
Thanks for the support!
11:07:05.248 [Time-limited test] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
11:07:05.267 [Time-limited test] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
11:07:05.269 [Time-limited test] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://www.googleapis.com:443][total available: 0; route allocated: 0 of 20; total allocated: 0 of 200]
11:07:05.295 [Time-limited test] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->https://www.googleapis.com:443][total available: 0; route allocated: 1 of 20; total allocated: 1 of 200]
11:07:05.298 [Time-limited test] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://www.googleapis.com:443
11:07:05.339 [Time-limited test] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to www.googleapis.com/216.58.208.106:443
11:07:05.340 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to www.googleapis.com/216.58.208.106:443 with timeout 20000
11:07:05.395 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols:
11:07:05.395 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake
11:07:05.763 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Secure session established
11:07:05.764 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - negotiated protocol: TLSv1.2
11:07:05.764 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - negotiated cipher suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
11:07:05.765 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - peer principal: CN=upload.video.google.com, O=Google LLC, L=Mountain View, ST=California, C=US
11:07:05.766 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - peer alternative names: [upload.video.google.com, *.clients.google.com, *.docs.google.com, *.drive.google.com, *.gdata.youtube.com, *.googleapis.com, *.photos.google.com, *.upload.google.com, *.upload.youtube.com, *.youtube-3rd-party.com, bg-call-donation-alpha.goog, bg-call-donation-canary.goog, bg-call-donation-dev.goog, bg-call-donation.goog, upload.google.com, upload.youtube.com, uploads.stage.gdata.youtube.com]
11:07:05.767 [Time-limited test] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - issuer principal: CN=GTS CA 1O1, O=Google Trust Services, C=US
11:07:05.793 [Time-limited test] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 192.168.0.108:50464<->216.58.208.106:443
11:07:05.796 [Time-limited test] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: set socket timeout to 20000
11:07:05.797 [Time-limited test] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /batch/drive/v3 HTTP/1.1
11:07:05.797 [Time-limited test] DEBUG org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
11:07:05.800 [Time-limited test] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
11:07:05.803 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /batch/drive/v3 HTTP/1.1
11:07:05.804 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip
11:07:05.804 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Google-HTTP-Java-Client/1.39.2 (gzip)
11:07:05.804 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 265
11:07:05.805 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Type: multipart/mixed; boundary=__END_OF_PART__117f537e-0241-43a3-86ad-5fa4380c3d46__
11:07:05.805 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: www.googleapis.com
11:07:05.805 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
11:07:05.806 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "POST /batch/drive/v3 HTTP/1.1[\r][\n]"
11:07:05.807 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip[\r][\n]"
11:07:05.807 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: Google-HTTP-Java-Client/1.39.2 (gzip)[\r][\n]"
11:07:05.807 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Length: 265[\r][\n]"
11:07:05.807 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Type: multipart/mixed; boundary=__END_OF_PART__117f537e-0241-43a3-86ad-5fa4380c3d46__[\r][\n]"
11:07:05.807 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: www.googleapis.com[\r][\n]"
11:07:05.809 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
11:07:05.809 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
11:07:05.809 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "--__END_OF_PART__117f537e-0241-43a3-86ad-5fa4380c3d46__[\r][\n]"
11:07:05.809 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Length: 43[\r][\n]"
11:07:05.809 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Type: application/http[\r][\n]"
11:07:05.809 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "content-id: 1[\r][\n]"
11:07:05.809 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "content-transfer-encoding: binary[\r][\n]"
11:07:05.811 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
11:07:05.813 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "GET http://localhost:8081/test HTTP/1.1[\r][\n]"
11:07:05.816 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
11:07:05.817 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
11:07:05.817 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 >> "--__END_OF_PART__117f537e-0241-43a3-86ad-5fa4380c3d46__--[\r][\n]"
11:07:05.924 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
11:07:05.924 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Vary: Origin[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Vary: X-Origin[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Cache-Control: no-cache, no-store, max-age=0, must-revalidate[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Pragma: no-cache[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Expires: Mon, 01 Jan 1990 00:00:00 GMT[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Thu, 13 May 2021 09:07:05 GMT[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: multipart/mixed; boundary=batch_PBzPvdm43po_AAXnjLdqtdE[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Encoding: gzip[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Content-Type-Options: nosniff[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Frame-Options: SAMEORIGIN[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Security-Policy: frame-ancestors 'self'[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "X-XSS-Protection: 1; mode=block[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Server: GSE[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "Transfer-Encoding: chunked[\r][\n]"
11:07:05.925 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 200 OK
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Vary: Origin
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Vary: X-Origin
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Cache-Control: no-cache, no-store, max-age=0, must-revalidate
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Pragma: no-cache
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Expires: Mon, 01 Jan 1990 00:00:00 GMT
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Date: Thu, 13 May 2021 09:07:05 GMT
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Type: multipart/mixed; boundary=batch_PBzPvdm43po_AAXnjLdqtdE
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Encoding: gzip
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << X-Content-Type-Options: nosniff
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << X-Frame-Options: SAMEORIGIN
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Security-Policy: frame-ancestors 'self'
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << X-XSS-Protection: 1; mode=block
11:07:05.928 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Server: GSE
11:07:05.929 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
11:07:05.929 [Time-limited test] DEBUG org.apache.http.headers - http-outgoing-0 << Transfer-Encoding: chunked
11:07:05.938 [Time-limited test] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive indefinitely
11:07:05.955 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x1f][\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x8b][\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x8][\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x0][\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x0][\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x0][\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x0][\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x0][\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.956 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x0][\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x0][\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x85][\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x90][\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0xbd][\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "n[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0xc2][\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "00000001[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "0[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "0d9[\r][\n]"
11:07:05.957 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[0x14][0x85]wK~[0x87][0xfb][0x0][0xdc]bC[0xaa][0x16]#[0x6][0xca]_+A[0x95][0xc1][0x95][0xba]![0x93]X8Ub[0x9b][0xe4][0x82]B[0x9f][0xbe]a[0xa2]b[0x80][0xf9][0x1c]}[0xe7][0x7]qg(s[0xdb][0xf4][0xed]7=[0xe5]U2[0x8c]a;[0x9d]~[0xfb][0x9f]u~[0xa0]|[0xc1][0xd9],x[0xb2][0x9e]P[0x9f][0xa3]U`b,[0x8b][0xcc]P[0x11]|[0xdf][0x11][0xc5][0xab][0xfe]1WP[0xdb]&[0x6][0xdf]X[0x94][0x9c]q[0xf6][0xae]u[0xda][0x97]O[0x12][0x12][0x91][0xc0]g X[0x86][0xa3][0xcf]o[0x89]d[[0xea]PU9[0x86][0xcc][0x99][0xba][0xb1]4[0xf9][0xd2]K|[0xe5]ln[0xa8][0xd3][0xb5];[0xf6]@[0xe]ac[0xce]0[0x10][0x3][0x9]b[0xa4][0xc4][0x8b][0x12][0xcf][0xb0][0xda]h[0xce][0x16]m,[0xba][0xd8][0x87][0xbe][0x99][0xc9][0x9c][0xc5]Kt[0x1d]J[0x5][0xb1].N[0x1d][0xbe][0x7][0x95]i[0xd1][0xec][0xed]D\{[0xad][0xad][0xdf][0x93]S0[0xba][0x8c][0xf8][0xd7][0x1b][0xef]_[0x85][0xc8][0xd9][0x1f][0xb9][0xf2][0xb7][0xa5]N[0x1][0x0][0x0][\r][\n]"
Failure!
11:07:05.966 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "0[\r][\n]"
11:07:05.967 [Time-limited test] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
11:07:05.970 [Time-limited test] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection [id: 0][route: {s}->https://www.googleapis.com:443] can be kept alive indefinitely
11:07:05.971 [Time-limited test] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: set socket timeout to 0
11:07:05.972 [Time-limited test] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {s}->https://www.googleapis.com:443][total available: 1; route allocated: 1 of 20; total allocated: 1 of 200]
11:07:05.972 [Time-limited test] DEBUG org.apache.http.impl.execchain.MainClientExec - Cancelling request execution
UPDATE : I added GoogleJsonErrorContainer on BatchCallback and see the error for 'org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected'
Full trace :
at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:263)
at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:222)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:183)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:210)
at org.apache.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.java:312)
at org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:142)
at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)
at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:172)
at java.base/java.util.zip.InflaterInputStream.close(InflaterInputStream.java:232)
at java.base/java.util.zip.GZIPInputStream.close(GZIPInputStream.java:137)
at org.apache.http.client.entity.LazyDecompressingInputStream.close(LazyDecompressingInputStream.java:94)
at com.google.api.client.http.HttpResponse.ignore(HttpResponse.java:427)
at com.google.api.client.http.HttpResponse.disconnect(HttpResponse.java:441)
at com.google.api.client.googleapis.batch.BatchRequest.execute(BatchRequest.java:271)
at com.assessment.fedex.BatchRequestTest.testResponse(BatchRequestTest.java:176)
Hi,
This is not enough information to debug this issue. Can you provide a code snippet?
Hello, Here's the code snippet -> I think I understood wrongly :( this API is only to call Google service (request in batch). Am I correct?
Caller client = new Caller.Builder(new ApacheHttpTransport(), new GsonFactory(),
"www.googleapis.com/batch", "", null, false).setApplicationName("BatchExample/1.0").build
();
batchRequest = client.batch();
GenericUrl rul = new GenericUrl("http://localhost:8081/test");
HttpRequestFactory httpRequestFactory = new ApacheHttpTransport().createRequestFactory();
HttpRequest request1 = httpRequestFactory.buildRequest("GET",rul, null);
for (int i = 0; i < BATCH_SIZE; i++) {
batchRequest.queue(request1, String.class, GoogleJsonErrorContainer.class, callback);
}