2020 Aug 10 12:00 PM
Hi Every one,
We are facing an issue while sending json data to an external api using CL_HTTP_CLIENT.
The JSON data is produced using '/ui2/cl_json=>serialize( data = ls_body compress = abap_true pretty_name = /ui2/cl_json=>pretty_mode-camel_case )' .
when sending this JSON as data the the external api returns status 400 with response as
{ "errorCode": "INVALID_REQUEST_BODY", "message": "The request body is missing or improperly formatted. Unexpected character encountered while parsing value: \u001f. Path '', line 0, position 0." } .
we also stringyfied this JSON Data in backend as it might be due to parsing error but it didnt work.
The same stringyfied data tried to send through browser console using ajax and it did worked without any issue.
could any any one tell us how to handle this json object and send this to external api using CL_HTTP_CLIENT.
Note : JSON STRING is deeply nested .
Thanks in advance..
2020 Aug 11 2:32 PM
Solved here by the OP: "The issue was with the unicodes in the string. these were not accepted by the external api so removed from the string and sent to api and it did worked."
Solved here by the OP: "The issue was with the unicodes in the string. these were not accepted by the external api so removed from the string and sent to api and it did worked."
2020 Aug 10 12:05 PM
Hello rahulpippalla
I think it might be of help if you provide the code you're using to send the JSON.
Kind regards,2020 Aug 10 12:24 PM
Why do you send the character \u001f (U+001F) in the body? Use ICM trace (SMICM) to get the exact message sent.
2020 Aug 11 5:39 AM
Hello @mateuszadamusIts just a json data which was created from internal table thats all.
one thing is that it contains base64 content as well in it.
thanks and regards,
Rahul
2020 Aug 11 5:43 AM
Hello @sandra.rossi ,
we didnt add ani unicodes to it. The same data which was sent from abap was downloaded and sent from the postman and it did worked.
we did checked in smicm and were unable to trace. could you please tell what can we do there..?
Thanks and regards,
Rahul.
2020 Aug 11 6:42 AM
2020 Aug 11 9:00 AM
You "didn't add any Unicode" but anyway the fact is that there's one (or the log is buggy). Sorry about the ICM trace, it's in fact the ICF client recorder in transaction code SICF, see there: https://blogs.sap.com/2006/04/05/icf-recording-a-possibility-for-analysing/
2020 Aug 11 2:32 PM
Solved here by the OP: "The issue was with the unicodes in the string. these were not accepted by the external api so removed from the string and sent to api and it did worked."
2020 Aug 12 8:36 AM
That is what I thought 🙂 Thanks for updating
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |