Hello,
I`m using a POST request with a JSON throught CL_HTTP_CLIENT.
Faced the following situation:
When xstrlen( jsonx ) <= 1024
http_rc = 200. "OK"
When xstrlen( jsonx ) > 1024
http_rc = 400. "Incorrect data given"
Tried to send the same data not via SAP client - Result 200. "OK"
Instead of client->request->set_data I used client->request->set_сdata, the result is similar, as soon as the string size exceeds 1024 bytes, I get a 400 response.
icm/HTTP/max_request_size_KB - 102400
What could be the error, am I somehow filling in the data incorrectly?
Where can there be size limits for request data?
DATA: client TYPE REF TO if_http_client.
cl_http_client=>create_by_destination( EXPORTING
destination = 'z_test'
IMPORTING
client = client ).
client->propertytype_logon_popup = if_http_client=>co_disabled.
client->request->set_version( if_http_request=>co_protocol_version_1_1 ).
client->request->set_method( if_http_request=>co_request_method_post ).
client->request->set_header_field( name = 'Accept' value = 'application/json' ).
client->request->set_header_field( name = 'Content-Type' value = 'application/json' ).
client->request->set_header_field( name = 'Authorization' value = |Bearer TokenValue| ).
DATA jsonx TYPE xstring.
json = '{"someLongJSON....}'.
jsonx = cl_abap_codepage=>convert_to(
source = json
codepage = 'UTF-8' ).
DATA(json_lenx) = xstrlen( jsonx ).
client->request->set_data( data = jsonx
offset = 0
length = json_lenx ).
* DATA(get_jsonx) = client->request->get_cdata( ).
CALL METHOD client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5.
IF sy-subrc <> 0.
RAISE connection_error.
ENDIF.
CALL METHOD client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
IF sy-subrc = 0.
DATA: http_rc TYPE sy-subrc.
client->response->get_status( IMPORTING code = http_rc ).
l_xml = client->response->get_cdata( ).
ENDIF.
client->close( ).