Go to se80, create a new package and a new class:
Open the source-code based view:
Add the interface and code snippet and activate the class:
CLASS zcl_my_abap2ui5_http_handler DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_http_extension.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_my_abap2ui5_http_handler IMPLEMENTATION.
METHOD if_http_extension~handle_request.
DATA(lv_resp) = SWITCH #( server->request->get_method( )
WHEN 'GET' THEN z2ui5_cl_fw_http_handler=>http_get( )
WHEN 'POST' THEN z2ui5_cl_fw_http_handler=>http_post( server->request->get_cdata( ) ) ).
server->response->set_header_field( name = `cache-control` value = `no-cache` ).
server->response->set_cdata( lv_resp ).
server->response->set_status( code = 200 reason = `success` ).
ENDMETHOD.
ENDCLASS.
Next go to transaction SICF:
Create at you favorite position a new node:
Accept this:
and:
Save and choose your package:
Go back and activate the service:
Now test the service:
You should see the starting page now: