Hi,
We have used the following code to send a xml string to a RFC destination. The code runs ok, however sometimes we have the same issue: The xml is sended empty and we have no idea the reason. Any idea? testing de conection via SM59 all seems ok.
Thanks!!!
The code:
DATA: http_client TYPE REF TO if_http_client,
listen_cli TYPE REF TO if_http_client.
DATA xml_pr TYPE string.
DATA: client TYPE REF TO if_http_client.
DATA: cclient TYPE REF TO if_http_client.
DATA: fields TYPE tihttpnvp,
fields_wa TYPE ihttpnvp.
CALL METHOD cl_http_client=>create_by_destination
EXPORTING
destination = destination
IMPORTING
client = http_client
EXCEPTIONS
argument_not_found = 1
destination_not_found = 2
destination_no_authority = 3
plugin_not_active = 4
internal_error = 5
OTHERS = 6.
IF sy-subrc <> 0.
RAISE connect_failed.
ENDIF.
CALL METHOD http_client->request->set_form_field
EXPORTING
name = 'xml'
value = w_xml.
CALL METHOD http_client->request->set_method
EXPORTING
method = 'POST'.
CALL METHOD http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2.
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.