SAP Knowledge Base Article - Preview

3737399 - CL_HTTP_CLIENT POST to OData v4 fails with 403 CSRF token invalid or 404 via destination

Symptom

  • OData v4 service created with ABAP RAP works for GET/POST/PATCH in Gateway Client, but POST from an ABAP class using CL_HTTP_CLIENT fails:
    • POST via CL_HTTP_CLIENT created by URL returns HTTP 403 Forbidden. Error payload contains code "/IWBEP/CM_V4H_RUN/042", message "CSRF token is invalid", category "CSRF_Token_Missing".
    • POST via CL_HTTP_CLIENT created by RFC destination returns HTTP 404 Not Found with "Service cannot be reached".
    • GET via CL_HTTP_CLIENT succeeds.


Read more...

Environment

SAP S/4HANA

Product

SAP S/4HANA all versions

Keywords

cl_http_client, odata v4, csrf token invalid, 403 forbidden, 404 not found, x-csrf-token, CSRF_Token_Missing, /IWBEP/CM_V4H_RUN/042, SM59, accept cookie, RFC destination, ABAP RAP, gateway client, post request, cookie handling , KBA , BC-ESI-ESF-BSA , Business Service Adaptation , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.