I have a number of web pages that are used in a stateless anonymous web site. As there are numerous data types that have to persist across all the pages I thought that server-side cookies would be the best option. However, when I try to write/read with a dynamic session_id I keep getting a 'cookie not found' error.
The cookie is written on one page with:
CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie EXPORTING name = 'TEST' application_name = 'NONE' application_namespace = 'NONE' username = 'NONE' session_id = runtime->session_id data_value = 'TEST VALUE' data_name = 'NONE' expiry_time_rel = 600.
Another page reads the cookie back with:
CALL METHOD cl_bsp_server_side_cookie=>get_server_cookie EXPORTING name = 'TEST' application_name = 'NONE' application_namespace = 'NONE' username = 'NONE' session_id = runtime->session_id data_name = 'NONE' CHANGING data_value = lv_test.
No error is given when writing the cookie, but a 'cookie not found' error is given when trying to read it back.
If the session_id parameter lines are hard-coded with a string
session_id = 'foobar'
then the cookie is successfully read.
I have tried putting the session_id into a string type, or using it within the username parameter, but still the same problem. The data types in and out of the cookie are the same, and the session id stays constant across the pages.
Any advice on how to get this working?