Skip to Content
0
Oct 27, 2018 at 04:39 AM

SSL Handshake failure via ABAP Code / SM59

4846 Views

Greetings

I am facing challenge in accessing a HTTPS URL https://iam.bluemix.net and am looking for some help.

Setup

  • - SAP Basis 740
  • - HTTPS Service setup
ssl/ciphersuites         135:PFS:HIGH::EC_P256:EC_HIGH 
ssl/client_ciphersuites  918:PFS:HIGH::EC_P256:EC_HIGH " Have tried with 150 as well
  • Certificate from TLD iam.bluemix.net has been imported in Base64-X509 format to ANONYM PSE

ABAP Code

I've tried sample code found on SCN/Google but it didn't work.

ICM Log

SM59

I tried to setup a G connection without SSL + No Auth + No Logon and got following error.

I've tried various combinations but they always land in the SSLV3 No certificate error (as in first screenshot). I've run out of ideas and in desperate need of some advice.

ABAP Code

REPORT .
DATA  html_control TYPE REF TO cl_gui_html_viewer.
DATA: l_empty_co    TYPE REF TO cl_gui_container.
DATA : gv_url TYPE string VALUE 'https://iam.bluemix.net'.
DATA : url_char TYPE C LENGTH 255.
DATA : http_client TYPE REF TO if_http_client.
DATA : post_data_string TYPE string.
DATA : data_length TYPE I.
DATA : lt_table TYPE TABLE OF char255 WITH HEADER LINE.
DATA : page_content TYPE xstring.
DATA : lt_ex_tab  LIKE  lxe_xtab OCCURS 1 WITH HEADER LINE.

CREATE OBJECT html_control
EXPORTING
  parent = l_empty_co.

CALL METHOD cl_http_client=>create_by_url
EXPORTING
  url    = gv_url
IMPORTING
  CLIENT = http_client
EXCEPTIONS
  OTHERS = 1.

CALL METHOD http_client->request->set_header_field
EXPORTING
  name  = '~request_method'
  VALUE = 'POST'.

CALL METHOD http_client->request->set_header_field
EXPORTING
  name  = 'Content-Type'
  VALUE = 'application/x-www-form-urlencoded'.

* post_data_string = 'lang=TR....'.

* data_length = STRLEN( post_data_string ).

* CALL METHOD http_client->request->set_cdata
* EXPORTING
*DATA   = post_data_string
*      offset = 0
*      length = data_length.


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


IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 DISPLAY LIKE sy-msgty.
EXIT.
ENDIF.


*   5 - Get the result back

************* FAILS AT THIS POINT ***************
CALL METHOD http_client->receive
EXCEPTIONS
  http_communication_failure = 1
  http_invalid_state         = 2
  http_processing_failed     = 3.


IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 DISPLAY LIKE sy-msgty.
EXIT.
ENDIF.


*   6 - Get the content of the returned page
page_content = http_client->response->get_data( ).


CALL FUNCTION 'LXE_COMMON_XSTRING_TO_TABLE'
EXPORTING
  in_xstring = page_content
TABLES
  ex_string  = lt_ex_tab.


CLEAR lt_table[].
LOOP AT lt_ex_tab.
APPEND lt_ex_tab-TEXT TO lt_table.
ENDLOOP.


url_char = gv_url.


CALL METHOD html_control->load_data
EXPORTING
  url                  = url_char
IMPORTING
  assigned_url         = url_char
CHANGING
  data_table           = lt_table[]
EXCEPTIONS
  dp_invalid_parameter = 1
  dp_error_general     = 2
  cntl_error           = 3
  OTHERS               = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 DISPLAY LIKE sy-msgty.
EXIT.
ENDIF.


CALL METHOD html_control->('DETACH_URL_IN_BROWSER')
EXPORTING
  url = gv_url.
cl_gui_cfw=>flush( ).

Attachments

capture.png (30.8 kB)
capture2.png (75.1 kB)