Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I created the simple job to call the web api via tRestClient, POST method with following details:
And here's the result:
So. I enable log message and here's the log:
Oct 05, 2021 2:00:08 AM org.apache.cxf.interceptor.LoggingOutInterceptor
INFO: Outbound Message
---------------------------
ID: 1
Address: https://api.nso.go.th/api/v1.0/branch10/dataset/278?year=2564&year=2564
Http-Method: POST
Content-Type: application/json;charset=utf-8
Headers: {Content-Type=[application/json;charset=utf-8], Accept=[*/*], Authorize=[authorize-string]}
--------------------------------------
Oct 05, 2021 2:00:09 AM org.apache.cxf.interceptor.LoggingInInterceptor
INFO: Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: ISO-8859-1
Content-Type: application/json
Headers: {Access-Control-Allow-Headers=[Content-Type], Access-Control-Allow-Methods=[GET,POST,PUT,DELETE,OPTIONS], Access-Control-Allow-Origin=[*], Access-Control-Credentials=[true], Cache-Control=[no-cache], content-encoding=[GZip], Content-Length=[3807], content-type=[application/json], Date=[Mon, 04 Oct 2021 19:00:09 GMT], Expires=[-1], Pragma=[no-cache], X-Powered-By=[ASP.NET]}
I also tried to call the same api with Postman and its result turn out fine (Noted: the results are in Thai characters).
I suspected that this issue has something to do with Talend or Java ,but I could not figure it out.
BR,
Sirasit
Hi, @Sirasit Mahawanitwong , you have an encoding problem, if postman send you fine result copy the same header in trestclient (like charset header), by default jvm charset is utf 8 you can also change this parameter.
Send me love and kudos
Hello again.
Thank you for the response!
I did checked the header which Postman use to request. There is no mention about charset in the header.