Здравствуйте,
Можно вот так.
xml_req - должен быть Ваш запрос.
xml_resp - ответ
Code:
http_dest = destination.
cl_http_client=>create_by_destination( EXPORTING
destination = http_dest IMPORTING client = client ).
CALL METHOD client->request->set_method(
if_http_request=>co_request_method_get ).
CALL METHOD client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.
* call method client->request->set_header_field
* exporting
* name = '~server_protocol'
* value = 'HTTPS'.
* value = 'HTTP/1.1'.
IF method IS NOT INITIAL.
CALL METHOD client->request->set_header_field
EXPORTING
name = '~request_uri'
value = method.
CALL METHOD client->request->set_header_field
EXPORTING
name = 'Content-Type'
value = 'text/xml; charset=utf-8;'.
ENDIF.
* call method client->request->set_formfield_encoding
* exporting
* formfield_encoding = 4110.
CALL METHOD client->request->set_data
EXPORTING
data = xml_req
offset = 0.
* CALL METHOD client->request->set_cdata
* EXPORTING
* data = wf_string
* offset = 0
* length = rlength.
* send and receive
CALL METHOD client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5.
IF sy-subrc <> 0.
* raise connection_error.
ENDIF.
CALL METHOD client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
rc = sy-subrc. "error receive
IF rc = 0.
**http status code
client->response->get_status( IMPORTING code = http_rc ).
IF http_rc <> 200.
CLEAR: xml_resp.
xml_resp = client->response->get_data( ).
* gxml_resp = client->response->get_cdata( ).
ELSE. "status 200 ->>OK
CLEAR: xml_resp.
xml_resp = client->response->get_data( ).
* gxml_resp = client->response->get_cdata( ).
ENDIF.
ELSEIF rc = 1.
DATA: lv_subrc TYPE sy-subrc
, lv_error TYPE string.
client->get_last_error( IMPORTING code = lv_subrc message = lv_error ).
MESSAGE e040(ZZZ) WITH http_dest lv_error.
ENDIF.