01-16-2018 10:59 AM
Dear.
I develop http api call program. but not sure it's post http call method.
Would you check it's post mehod or not ?
CALL METHOD cl_http_client=>create_by_destination
EXPORTING
destination = 'MGAGE_BULK'
IMPORTING
client = lo_client
EXCEPTIONS
destination_not_found = 1
internal_error = 2.
IF sy-subrc <> 0.
MESSAGE e000(cuan_mkt_exec_frw) INTO ev_message WITH 'MGAGE'.
RETURN.
ENDIF.
request = lo_client->request.
CALL METHOD request->set_header_field
EXPORTING
name = 'content-type'
value = 'text/html; charset=UTF-8'.
request->set_header_field( name = '~request_method'
value = 'POST' ).
CALL METHOD lo_client->request->set_method(
if_http_request=>co_request_method_post ).
CONCATENATE
* '<![CDATA[<MESSAGE VER="1.2">'
'<MESSAGE VER="1.2">'
'<USER USERNAME="' ls_config-char20 '" PASSWORD="' ls_config-char20a '" DLR="0"/>'
INTO lv_bodystr.
lv_seq = 0.
LOOP AT gt_smt_tran INTO gs_smt_tran.
CLEAR lv_result.
CLEAR name.
CLEAR value.
CLEAR lv_link_origin.
CLEAR lv_link_short.
CLEAR lv_query.
lv_seq = lv_seq + 1.
lv_seq_c = lv_seq.
REPLACE ALL OCCURRENCES OF '+' IN gs_smt_tran-recipient_num WITH '' .
CONCATENATE
lv_bodystr
'<SMS TEXT="' lv_query '" ID="' lv_seq_c
'" CUST_MID="' gs_smt_tran-recipient_num'-' gs_smt_tran-camp_id
'" MTAG="' gs_smt_tran-camp_id '">'
'<ADDRESS FROM="SAMSNG" TO="' gs_smt_tran-recipient_num '" SEQ="1"/>'
'</SMS>'
INTO lv_bodystr.
ENDLOOP.
CONCATENATE
lv_bodystr '</MESSAGE>'
INTO lv_bodystr.
CALL METHOD request->set_form_field
EXPORTING
name = 'data'
value = lv_bodystr.
CALL METHOD lo_client->send
EXCEPTIONS
http_communication_failure = 1
OTHERS = 4.
02-12-2018 7:56 PM
POST method = your code lo_client->request->set_method( if_http_request=>co_request_method_post ).