Skip to Content
Former Member
May 29, 2009 at 10:40 PM

Error when trying to run IF_HTTP_CLIENT->RECEIVE()


Hi experts,

I nedd to retrieve a file from any given URL (i.e. and save it.

I thought that calling if_http_client->receive() method would be ideal, but when I call it I´m always getting exception 'http_communication_failure'.

Transaction SMICM looks good...what else should I check?

I give my source code:

data: client  type ref to if_http_client,
      content type string.

****Create the HTTP client
cl_http_client=>create_by_url( exporting url = '' importing client = client exceptions others = 1 ).

****Set the Request type to GET
  client->request->set_header_field( name  = '~request_method'
                             value = 'GET' ).               "#EC *

****Make the call
  client->send( ).

****Receive the Response Object
  call method client->receive
      http_communication_failure = 1
      http_invalid_state         = 2
      http_processing_failed     = 3
      others                     = 4.

****Get the response content in Character format
  content = client->response->get_cdata( ).

Thanks for your help.