Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

JSON with https

Former Member
0 Likes
1,674

Hi

I'm attempting to read an API from my vendor whose site is in https.

I have added the certificate in STRUST t-code.

I am using the following method to create the client.

call method cl_http_client=>create(

    exporting

      host    = STR_host

      service = '443'

      scheme  = 2

    importing

      client  = lo_client ).

  lo_client->request->set_method( if_http_request=>co_request_method_get ).

  call method cl_http_utility=>set_request_uri( request = lo_client->request uri = lv_result_url ).

  lo_client->send( ).

  CALL METHOD lo_client->receive
    EXCEPTIONS
      http_communication_failure = 1
      http_invalid_state         = 2
      http_processing_failed     = 3
      OTHERS                     = 4.

but when i send to receive, it always return http_communication_failure.

Previously, I was able to connect when the site is on http only.

I wonder if anything else need to be done?

6 REPLIES 6
Read only

Former Member
0 Likes
1,017

Hi Rusyinni,

Have you maintained the proxy settings in SAP for HTTPS Connections?

If not, to maintain proxy settings...Go to SICF tcode->Click F8->Client menu->Proxy Settings->HTTPS Log

If this does not solve the issue, Go to SMICM t code...Click Display All(Shift + F5) and post the log message here so we can check what exactly is going wrong.

BR,

Aashrith.

Read only

0 Likes
1,017

Hi Aashrith,

Thanks for the reply.

I went to SMICM log, and found that the service/port is not yet maintained in SMICM.


After I maintained, I re-tested SM59, and got the following error now:

SSL client handshake with [website url]:443 failed SSSLERR_PEER_CERT_UNTRUSTED(-102)

Any other clues I should try?

How do I check the handshake certificate?

Rgds

Rusyinni

Read only

0 Likes
1,017

Hi Rusyinni,

Have you restarted ICM after adding the certificate?(transaction SMICM, Administration -> ICMAN -> Exit Soft)... Please refer 510007 note for details reg. all the settings required to be done for SSL.

I also found this link : , It might be of some help.

BR,

Aashrith

Read only

0 Likes
1,017


Hi

After I restarted ICM, the https service disappeared.

Why so?

Rgds

Rusyinni

Read only

0 Likes
1,017

You have to set the relevant profile parameter for the icm port in the instance profile in RZ10. Then the settings remain after system restart.

Kind regards,

Gørril

Read only

Former Member
0 Likes
1,017

Hi Rusyinni,

I was in a similar situation and I could fix my connection problems as I describe below.

First of all you say you have installed the certificate of the WEB server you are trying to connect to via HTTPS protocol. Please verify that you have added the certificate to the correct PSE file in the STRUST transaction. In my case, as I am using the anonymous SSL Client (CN=anonymous) , I added the server_i_want_to_connect_to.cer file to the corresponding PSE file.

Then I specified the ssl_id I wanted to use.

CALL METHOD cl_http_client=>create

  EXPORTING

    host               = l_host

    scheme             = 2 " HTTPS

    ssl_id             = 'ANONYM' " <<<<===========

  IMPORTING

    client             = lr_http_client

  EXCEPTIONS

    argument_not_found = 1

    plugin_not_active  = 2

    internal_error     = 3

    OTHERS             = 4.

After I did this procedure, I could connect to the remote web server with HTTPS and invoke the REST web services I required.

I hope this helps,

Best regards, Rafael