‎2010 Jan 10 5:12 PM
Hi All,
We want to send an HTTP post with parameters, and we are not sure how to do that. We tried to do that like the code below,but we get the parameters in the body and not in the header ...
DATA lo_client TYPE REF TO if_http_client.
DATA lv_status_code TYPE i.
DATA lv_reason TYPE string.
CALL METHOD cl_http_client=>create_by_destination
EXPORTING
destination = 'ZRFC_TEST'
IMPORTING
client = lo_client.
lo_client->request->set_method( if_http_request=>co_request_method_post ).
cl_http_utility=>set_request_uri( request = lo_client->request
uri = '?param1=value1' ).
lo_client->send( ).
lo_client->receive( ).
lo_client->response->get_status( IMPORTING code = lv_status_code
reason = lv_reason ).
Thanks a lot,
Tuvia.
‎2010 Jan 11 12:09 AM
Hi,
I am not sure if I understand your issue but as you know you can set up GET parameters just by modifying URL and you should be able to modify post parameters by calling methods SET_FORM_FIELD and SET_FORM_FIELDS of request object. Similar as you set request method.
Cheers
‎2010 Jan 11 12:09 AM
Hi,
I am not sure if I understand your issue but as you know you can set up GET parameters just by modifying URL and you should be able to modify post parameters by calling methods SET_FORM_FIELD and SET_FORM_FIELDS of request object. Similar as you set request method.
Cheers
‎2010 Jan 11 9:39 AM
Hi Matrtin,
Thanks for your helpful answer. Your solution helps us to put the parameters in the body, but we need a way to put the
parameters on the query, do you know of a way to do that?
Thanks,
Tuvia.
‎2010 Jan 11 11:03 AM
Hi,
what do you mean by "parameters on the query". In any http request you can have two types of variables: POST or GET. The post variables are transferred in http header and you can add them using methods from my previous post. GET variables are transferred in URL. HTTP client has a method APPEND_FIELD_URL which can be used to add variable into URL string.
Cheers