Skip to Content
avatar image
-1
Former Member

Validate the URL before launch in ABAP

Hi All,

I have seen many discussions about URL check in ABAP before launch, but didn't found the answer which I need. Please find the below code for to check the URL is valid or not. But I am getting error http_communication_failure after Receive method.

Unfortunately I am not getting error even this is valid URL then why I am getting this?


Also I have checked the SICF for client proxy setting, there there are no settings present as of now.

CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = wf_string
IMPORTING
client = http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.

* proxy server authentication
CALL METHOD http_client->authenticate
EXPORTING
* proxy_authentication = 'X'
username = lv_id
password = lv_pwd.

http_client->propertytype_accept_cookie = if_http_client=>co_enabled.

CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.

CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.

CLEAR : err_string ,
code .

http_client->response->get_status(
IMPORTING
code = code
reason = err_string
).
IF code IS INITIAL .
CLEAR result .
result = http_client->response->get_cdata( ).
ENDIF .

*CALL METHOD cl_http_utility=>if_http_utility~is_valid_url
* EXPORTING
* url = wf_string
** black_pattern =
** white_pattern =
** restrictive = ABAP_TRUE
** options = URLCHECK_DEFAULT
* RECEIVING
* is_ok = lv_ok.

BREAK-POINT.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers