2023 Dec 14 3:52 PM
Hi Experts,
We are using interface if_http_client to check if page "http://www.sap.com/benchmark" is working.
To create an instance we use cl_http_client=>create_by_url ().
Then call lo_http_client->send()
and lo_http_client->receive()
and with lo_http_client->response->get_status() the response code is 403 Forbidden.
The URL is working fine when testing it in the browser.
cl_http_client=>create_by_url(
EXPORTING
url = iv_url_str
IMPORTING
client = lo_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
lo_http_client->get_last_error( IMPORTING message = lv_error_message ).
RETURN.
ENDIF.
lo_http_client->send(
EXPORTING timeout = 60
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
lo_http_client->get_last_error( IMPORTING message = lv_error_message ).
RETURN.
ENDIF.
lo_http_client->receive(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
lo_http_client->get_last_error( IMPORTING message = lv_error_message ).
RETURN.
ENDIF.
lo_http_client->response->get_status(
IMPORTING
code = lv_http_response_code
reason = lv_reason_str ).
IF lv_http_response_code >= 400.
lo_http_client->get_last_error( IMPORTING message = lv_error_message ).
RETURN.
ENDIF.
2023 Dec 14 4:07 PM
2023 Dec 14 4:07 PM
2023 Dec 14 4:15 PM
It is the same issue with URL https://www.sap.com/about/benchmark.html. (And yes we will change this. :-))
2023 Dec 14 5:28 PM