cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Http_Communication_Failure in IF_HTTP_CLIENT-->receive

ios_Developer
Newcomer
0 Kudos
457

Hi experts,
Im consumin an api in my abap code. but it resulting in dump "http communicaiton failure". while i debugged the program i found it gives dump at receive methode call. need steps to resolve it asap, code is attached. thanks in advance.
TRY.
data(lv_url|http://******|.  " here is my url
datao_client type ref to if_http_client.
cl_http_client=>CREATE_BY_URLEXPORTING
                               URL lv_url
                               IMPORTING
                                 client o_client
                                 EXCEPTIONS
                                   ARGUMENT_NOT_FOUND 1
                                   PLUGIN_NOT_ACTIVE 2
                                   INTERNAL_ERROR ).
if sy-subrc <> 0.
  o_client->CLOSE).
  endif.
if o_client is bound.
  o_client->REQUEST->SET_METHODif_http_request=>CO_REQUEST_METHOD_POST ).
  o_client->REQUEST->SET_CONTENT_TYPE'application/json' ).

*  Set Item Details - Ended
    /UI2/CL_JSON=>SERIALIZE(
    EXPORTING
    DATA IT_DATA        " Data to serialize
    PRETTY_NAME /UI2/CL_JSON=>PRETTY_MODE-CAMEL_CASE
    RECEIVING
    R_JSON GV_JSON ).   " JSON string

    o_client->REQUEST->SET_CDATAGV_JSON ).

    o_client->SENDtimeout if_http_client=>co_timeout_default ).
    o_client->RECEIVE).

    datalv_http_Status type i,
          lv_status_text type string.

    o_client->RESPONSE->GET_STATUS(
                                   IMPORTING
                                     code lv_http_status
                                     reason lv_status_text ).

    writelv_status_text.



  endif.

CATCH cx_root into data(lv_text.

ENDTRY.

Accepted Solutions (0)

Answers (0)