Retrieval of log file information

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
IBMOLIVIER
Posts: 6
Joined: Fri Dec 02, 2022 2:34 pm

Retrieval of log file information

Post by IBMOLIVIER »

Hello, in the Log file how to retrieve this message in my program ?

{"utilisateurID":["Unexpected character encountered while parsing value: }. Path 'utilisateurID', line 1, position 288.","Unexpected end when deserializing object. Path 'utilisateurID', line 1, position 5000."]}
comm_blockread returned 211



In my code I have this which actually retrieves the following information "400 "

Prm_Retour = %Char(Rc);
// Inserer le contenu du .json dans une table
data-into putapiwms_err %DATA(%Trim(FILENAME)
:'doc=FILE case=convert allowmissin
allowextra=yes trim=none countprefi
%PARSER('YAJLINTO');
Prm_MessageErreur = putapiwms_err.validationResult
Prm_LogLevel = putapiwms_err.validationResult
unlink(Filename);
endif;
on-error;
http_error(Erreur_http);
wwErrorMsg = http_error(Erreur_http);
http_dmsg('SetError() #' +
%trim(%editc(Erreur_http:'L')) +
': '+ wwErrorMsg);
Prm_Retour = %subst(wwErrorMsg:10:3);






Log file:

recvresp(): entered
HTTP/1.1 400 Bad Request
Server: openresty
Date: Tue, 28 Mar 2023 09:11:42 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Gravitee-Transaction-Id: 7dabedff-3b46-4fa6-abed-ff3b464fa622
X-Gravitee-Request-Id: 7dabedff-3b46-4fa6-abed-ff3b464fa622
X-Powered-By: ASP.NET


SetError() #13: HTTP/1.1 400 Bad Request
recvresp(): end with 400
recvdoc parms: chunked 0
header_load_cookies() entered
recvchunk(): entered
get_chunk_size(): entered
d3

chunk size = 211
get_chunk_size returned 211
calling comm_blockread
{"utilisateurID":["Unexpected character encountered while parsing value: }. Path 'utilisateurID', line 1, position 288.","Unexpected end when deserializing object. Path 'utilisateurID', line 1, position 5000."]}

comm_blockread returned 211


get_chunk_size(): entered
0

chunk size = 0
get_chunk_size returned 0
SetError() #13: HTTP/1.1 400 Bad Request
http_close(): entered
HTTPAPI Ver 1.45 released 2021-09-20
Scott Klement
Site Admin
Posts: 635
Joined: Sun Jul 04, 2021 5:12 am

Re: Retrieval of log file information

Post by Scott Klement »

You haven't shown us the code that calls HTTPAPI... but, basically, you will get this JSON document as output from HTTPAPI.

For example, if you're doing:

Code: Select all

jsonDoc = http_string(url: other-parameters-here);
Then jsonDoc will be the JSON you are showing -- it doesn't matter that it's a 400 error -- it'll still be filled in.
Post Reply