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.
|
||||
|
@ -124,30 +124,36 @@ CLASS ZCL_ABAPGIT_HTTP IMPLEMENTATION.
|
|||
|
||||
CREATE OBJECT lo_proxy_configuration.
|
||||
|
||||
cl_http_client=>create_by_url(
|
||||
EXPORTING
|
||||
url = zcl_abapgit_url=>host( iv_url )
|
||||
ssl_id = 'ANONYM'
|
||||
proxy_host = lo_proxy_configuration->get_proxy_url( iv_url )
|
||||
proxy_service = lo_proxy_configuration->get_proxy_port( iv_url )
|
||||
IMPORTING
|
||||
client = li_client
|
||||
EXCEPTIONS
|
||||
argument_not_found = 1
|
||||
plugin_not_active = 2
|
||||
internal_error = 3
|
||||
OTHERS = 4 ).
|
||||
IF sy-subrc <> 0.
|
||||
CASE sy-subrc.
|
||||
WHEN 1.
|
||||
" 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
|
||||
li_client = zcl_abapgit_exit=>get_instance( )->create_http_client( iv_url ).
|
||||
|
||||
IF li_client IS NOT BOUND.
|
||||
|
||||
cl_http_client=>create_by_url(
|
||||
EXPORTING
|
||||
url = zcl_abapgit_url=>host( iv_url )
|
||||
ssl_id = 'ANONYM'
|
||||
proxy_host = lo_proxy_configuration->get_proxy_url( iv_url )
|
||||
proxy_service = lo_proxy_configuration->get_proxy_port( iv_url )
|
||||
IMPORTING
|
||||
client = li_client
|
||||
EXCEPTIONS
|
||||
argument_not_found = 1
|
||||
plugin_not_active = 2
|
||||
internal_error = 3
|
||||
OTHERS = 4 ).
|
||||
IF sy-subrc <> 0.
|
||||
CASE sy-subrc.
|
||||
WHEN 1.
|
||||
" 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.
|
||||
|
||||
IF lo_proxy_configuration->get_proxy_authentication( iv_url ) = abap_true.
|
||||
|
|
|
@ -93,6 +93,16 @@ CLASS zcl_abapgit_exit IMPLEMENTATION.
|
|||
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.
|
||||
|
||||
TRY.
|
||||
|
|
|
@ -9,14 +9,21 @@ INTERFACE zif_abapgit_exit PUBLIC.
|
|||
allow_sap_objects
|
||||
RETURNING VALUE(rv_allowed) TYPE abap_bool,
|
||||
change_proxy_url
|
||||
IMPORTING iv_repo_url TYPE csequence
|
||||
IMPORTING iv_repo_url TYPE csequence
|
||||
CHANGING cv_proxy_url TYPE string,
|
||||
change_proxy_port
|
||||
IMPORTING iv_repo_url TYPE csequence
|
||||
IMPORTING iv_repo_url TYPE csequence
|
||||
CHANGING cv_proxy_port TYPE string,
|
||||
change_proxy_authentication
|
||||
IMPORTING iv_repo_url TYPE csequence
|
||||
IMPORTING iv_repo_url TYPE csequence
|
||||
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
|
||||
IMPORTING
|
||||
ii_client TYPE REF TO if_http_client,
|
||||
|
|
Loading…
Reference in New Issue
Block a user