Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Error HTTPIO_PLG_CANCELED when calling http_client->receive

$
0
0

Hello,

 

I want to check the existence of a specific URL from ABAP. Here is the coding

 

report zmmrsl_check_url.

 

data: http_client type ref to if_http_client

     , result      type string

     , err_string  type string

     , code        type sy-subrc

     , lv_url      type string

     , subrc       type sysubrc

     , errortext   type string

     .

 

call method cl_http_client=>create

  exporting host  = 'www.anycompanie.de'

    service       = '443'

     scheme        = '2'

  importing client  = http_client

  exceptions

          argument_not_found = 1

          internal_error     = 2

          plugin_not_active  = 3

          others             = 4.

 

* set http method GET

call method http_client->request->set_method(

   if_http_request=>co_request_method_get ).

 

* set request uri (/<path>[?<querystring>])

cl_http_utility=>set_request_uri( request = http_client->request

                                    uri    = 'path/anyfile.jpg' ).

 

call method http_client->send

   exceptions

     http_communication_failure = 1

     http_invalid_state         = 2.

 

if sy-subrc <> 0.

   call method http_client->get_last_error

     importing

       code    = subrc

       message = errortext.

   write: / 'communication_error( send )',

          / 'code: ', subrc, 'message: ', errortext.

   exit.

endif.

 

call method http_client->receive

   exceptions

     http_communication_failure = 1

     http_invalid_state         = 2

     http_processing_failed     = 3.

 

if sy-subrc <> 0.

   call method http_client->get_last_error

     importing

       code    = subrc

       message = errortext.

   write: / 'communication_error( receive )',

          / 'code: ', subrc, 'message: ', errortext.

   exit.

endif.

 

The method http_client->receive always return the subrc 1 with code 110 and HTTPIO_PLG_CANCELED. Any ideas what's wrong here?

 

Thanks in advance

Frank-Thomas


Viewing all articles
Browse latest Browse all 8332

Trending Articles