mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
New user exit create_http_client
With this commit one can implement the new user exit method create_http_client for custom http client instantiation. E.g. to use RFC destinations.
This commit is contained in:
parent
491306ff41
commit
fbc4896d65
|
@ -36,7 +36,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS ZCL_ABAPGIT_HTTP IMPLEMENTATION.
|
CLASS zcl_abapgit_http IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD acquire_login_details.
|
METHOD acquire_login_details.
|
||||||
|
@ -124,30 +124,36 @@ CLASS ZCL_ABAPGIT_HTTP IMPLEMENTATION.
|
||||||
|
|
||||||
CREATE OBJECT lo_proxy_configuration.
|
CREATE OBJECT lo_proxy_configuration.
|
||||||
|
|
||||||
cl_http_client=>create_by_url(
|
li_client = zcl_abapgit_exit=>get_instance( )->create_http_client( iv_url ).
|
||||||
EXPORTING
|
|
||||||
url = zcl_abapgit_url=>host( iv_url )
|
IF li_client IS NOT BOUND.
|
||||||
ssl_id = 'ANONYM'
|
|
||||||
proxy_host = lo_proxy_configuration->get_proxy_url( iv_url )
|
cl_http_client=>create_by_url(
|
||||||
proxy_service = lo_proxy_configuration->get_proxy_port( iv_url )
|
EXPORTING
|
||||||
IMPORTING
|
url = zcl_abapgit_url=>host( iv_url )
|
||||||
client = li_client
|
ssl_id = 'ANONYM'
|
||||||
EXCEPTIONS
|
proxy_host = lo_proxy_configuration->get_proxy_url( iv_url )
|
||||||
argument_not_found = 1
|
proxy_service = lo_proxy_configuration->get_proxy_port( iv_url )
|
||||||
plugin_not_active = 2
|
IMPORTING
|
||||||
internal_error = 3
|
client = li_client
|
||||||
OTHERS = 4 ).
|
EXCEPTIONS
|
||||||
IF sy-subrc <> 0.
|
argument_not_found = 1
|
||||||
CASE sy-subrc.
|
plugin_not_active = 2
|
||||||
WHEN 1.
|
internal_error = 3
|
||||||
" make sure:
|
OTHERS = 4 ).
|
||||||
" a) SSL is setup properly in STRUST
|
IF sy-subrc <> 0.
|
||||||
lv_text = 'HTTPS ARGUMENT_NOT_FOUND | STRUST/SSL Setup correct?'.
|
CASE sy-subrc.
|
||||||
WHEN OTHERS.
|
WHEN 1.
|
||||||
lv_text = 'While creating HTTP Client'. "#EC NOTEXT
|
" make sure:
|
||||||
|
" a) SSL is setup properly in STRUST
|
||||||
|
lv_text = 'HTTPS ARGUMENT_NOT_FOUND | STRUST/SSL Setup correct?'.
|
||||||
|
WHEN OTHERS.
|
||||||
|
lv_text = 'While creating HTTP Client'. "#EC NOTEXT
|
||||||
|
|
||||||
|
ENDCASE.
|
||||||
|
zcx_abapgit_exception=>raise( lv_text ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
ENDCASE.
|
|
||||||
zcx_abapgit_exception=>raise( lv_text ).
|
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF lo_proxy_configuration->get_proxy_authentication( iv_url ) = abap_true.
|
IF lo_proxy_configuration->get_proxy_authentication( iv_url ) = abap_true.
|
||||||
|
|
|
@ -93,6 +93,16 @@ CLASS zcl_abapgit_exit IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD zif_abapgit_exit~create_http_client.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
ri_client = gi_exit->create_http_client( iv_url ).
|
||||||
|
CATCH cx_sy_ref_is_initial cx_sy_dyn_call_illegal_method.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD zif_abapgit_exit~http_client.
|
METHOD zif_abapgit_exit~http_client.
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
|
|
|
@ -9,14 +9,21 @@ INTERFACE zif_abapgit_exit PUBLIC.
|
||||||
allow_sap_objects
|
allow_sap_objects
|
||||||
RETURNING VALUE(rv_allowed) TYPE abap_bool,
|
RETURNING VALUE(rv_allowed) TYPE abap_bool,
|
||||||
change_proxy_url
|
change_proxy_url
|
||||||
IMPORTING iv_repo_url TYPE csequence
|
IMPORTING iv_repo_url TYPE csequence
|
||||||
CHANGING cv_proxy_url TYPE string,
|
CHANGING cv_proxy_url TYPE string,
|
||||||
change_proxy_port
|
change_proxy_port
|
||||||
IMPORTING iv_repo_url TYPE csequence
|
IMPORTING iv_repo_url TYPE csequence
|
||||||
CHANGING cv_proxy_port TYPE string,
|
CHANGING cv_proxy_port TYPE string,
|
||||||
change_proxy_authentication
|
change_proxy_authentication
|
||||||
IMPORTING iv_repo_url TYPE csequence
|
IMPORTING iv_repo_url TYPE csequence
|
||||||
CHANGING cv_proxy_authentication TYPE abap_bool,
|
CHANGING cv_proxy_authentication TYPE abap_bool,
|
||||||
|
create_http_client
|
||||||
|
IMPORTING
|
||||||
|
iv_url TYPE string
|
||||||
|
RETURNING
|
||||||
|
VALUE(ri_client) TYPE REF TO if_http_client
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception,
|
||||||
http_client
|
http_client
|
||||||
IMPORTING
|
IMPORTING
|
||||||
ii_client TYPE REF TO if_http_client,
|
ii_client TYPE REF TO if_http_client,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user