cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Communication Failure while implementing Restful Web services in ABAP

deepakm1
Discoverer
0 Kudos

Hello,

Our requirement is to post data through Restful Web Services.

But we are getting HTTP Communication Failure.

Below is the ABAP Code :

lv_url = 'https://www.something.com?parameter1=value1¶meter2=value2...'.

CALL METHOD cl_http_client=>create_by_url

EXPORTING

url = lv_url

* proxy_host =

* proxy_service =

* ssl_id =

* sap_username =

* sap_client =

IMPORTING

client = lo_http_client

EXCEPTIONS

argument_not_found = 1

plugin_not_active = 2

internal_error = 3

OTHERS = 4.

CALL METHOD lo_http_client->request->set_header_field

EXPORTING

name = '~request_protocol'

value = 'HTTPS/1.0'.

CALL METHOD lo_http_client->request->set_header_field

EXPORTING

name = '~request_method'

value = 'POST'.

CALL METHOD lo_http_client->send

EXCEPTIONS

http_communication_failure = 1

http_invalid_state = 2.

CALL METHOD lo_http_client->receive

EXCEPTIONS

http_communication_failure = 1

http_invalid_state = 2

http_processing_failed = 3.

CLEAR lv_result .

lv_result = lo_http_client->response->get_cdata( ).

lv_http_status = lo_http_client->response->get_header_field('~status_code').

Here we are getting HTTP Status code "500".

If we try through RFC destination then we get nieconn_refused(-10) error.

API URL is working fine when it is called directly in browser.

Is this approach correct or am I missing something or any BASIS settings required?

I also tried executing Demo program DEMO_HTTP_CLIENT, but still we are getting nieconn_refused(-10) error.

Accepted Solutions (0)

Answers (0)