Hi All,
I am trying to call an HTTP url from the ABAP system using the following code :-
data: host type string VALUE 'xxxxxxxxxxxxxxxxxxxxxxxxxx/Channels/GetPartComplianceByRoHS',
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = HOST
IMPORTING
client = lo_http_client
* EXCEPTIONS
* argument_not_found = 1
* plugin_not_active = 2
* internal_error = 3
* others = 4
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CALL METHOD lo_http_client->REQUEST->SET_HEADER_FIELD
EXPORTING
NAME = '~server_protocol'
VALUE = 'HTTP/1.1'.
*
IF i_content_type = space.
i_content_type = 'text/xml; charset=utf-16'.
ENDIF.
CALL METHOD lo_http_client->request->set_content_type
EXPORTING
content_type = i_content_type.
callmethod lo_http_client->request->set_header_field
exporting
name = 'Content-Length'
value= txlen.
* CALL METHOD lo_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
* EXPORTING NAME = 'Accept'
* VALUE = 'text/xml, text/html'.
***Set the Request type to GET
CALL METHOD lo_http_client->request->set_header_field
EXPORTING
name = '~request_method'
value= 'GET'.
callmethod lo_http_client->request->set_header_field
exporting
name = 'SOAPAction'
value= 'GetROHSRequest'.
* Add our data to the http body...
CALL METHOD lo_http_client->request->set_cdata
EXPORTING
data = gt_itab
offset = 0
length = rlength
EXCEPTIONS
OTHERS = 1.
lv_timeout = if_http_client=>co_timeout_default.
** Post the data...
CALL METHOD lo_http_client->send
EXPORTING
timeout = lv_timeout
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
callmethod lo_http_client->receive
exceptions
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
* Grab http status reported by remote server...
CALL METHOD lo_http_client->response->get_status
IMPORTING
code = lv_code
reason = http_status_text.
* http_status = lv_http_status.
cleargt_itab1 .
CALL METHOD lo_http_client->response->get_cdata
RECEIVING
data= gt_itab1.
HTTP request status code and message says 200 and OK.
And there is no exception as well.
However, I am not able to received any data in gt_itab1 from method 'response->get_cdata()'
Please help on this
Regard's
Suresh