Skip to content

Latest commit

 

History

History
61 lines (49 loc) · 3.16 KB

create_http_on_prem.md

File metadata and controls

61 lines (49 loc) · 3.16 KB

Create On-Premise HTTP Handler

Go to se80, create a new package and a new class:
image

Open the source-code based view:
image

Add the interface and code snippet and activate the class:
image

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:
image

Create at you favorite position a new node:
image

Accept this:
image

and:
image

image

Save and choose your package:
image

Go back and activate the service:
image

Now test the service:
image

You should see the starting page now:
image

Known Issues

Sometimes you need to activate manually SSL: image