Dear experts,
I trying to get status from sandbox server but getting 404 - Not Found error in status code below is my code please check and help me ASAP.
data: lo_http_client type ref to if_http_client,
lv_service type string,
** lv_service TYPE rfcdest VALUE 'CITRUS',
lv_result type string,
lo_ixml type ref to if_ixml,
lo_streamfactory type ref to if_ixml_stream_factory,
lo_istream type ref to if_ixml_istream,
lo_document type ref to if_ixml_document,
lo_parser type ref to if_ixml_parser,
lo_weather_element type ref to if_ixml_element,
lo_weather_nodes type ref to if_ixml_node_list,
lo_curr_node type ref to if_ixml_node,
lv_value type string,
lv_node_length type i,
lv_node_index type i,
ls_weather type zweather,
lv_node_name type string,
lv_node_value type string.
data lv_message type string.
data tran_id type zms_trans.
data: http_status_code type i.
data: status_text type string.
data w_result type xstring.
lv_service = 'http://sandXXXXadmin.pay.com/api/v2/txn/enquiry'.
cl_http_client=>create_by_url(
exporting
url = lv_service
** proxy_host = 'sandXXX.pay.com' "
** proxy_service = '1api6ek84h'
importing
client = lo_http_client
exceptions
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
others = 4 ).
data soap_action type string.
** CONCATENATE lv_service '#' 'b79tjdmuw9.MSETCL30000021' INTO soap_action.
concatenate lv_service '?' '/MSETCL30000021' into soap_action.
call method lo_http_client->request->set_header_field
exporting
name = '~host'
value = 'b79tjdmuw9'. "sandbox.citruspay.com'.
call method lo_http_client->authenticate
exporting
proxy_authentication = abap_true
username = 'tejastikale@gmail.com'
password = 'Msetcl@2015'.
call method lo_http_client->request->set_header_field
exporting
name = '~server_protocol'
value = 'HTTP/1.1'.
call method lo_http_client->request->set_header_field
exporting
name = '~request_method'
value = 'POST'. "'GET'.
call method lo_http_client->request->set_header_field
exporting
name = 'Accept'
value = 'application/json'.
call method lo_http_client->request->set_header_field
exporting
name = 'Content-Type'
value = 'application/json; charset=utf-8'.
call method lo_http_client->request->set_method
exporting
method = 'POST'. "co_request_method_get.
**--Set Url to request
cl_http_utility=>set_request_uri( request = lo_http_client->request uri = soap_action ).
** CALL METHOD lo_http_client->request->set_header_field
** EXPORTING
** name = 'SOAPAction'
** value = soap_action.
** lo_http_client->request->set_header_field(
** EXPORTING
** name = '~request_uri' " Name of the header field
** value = soap_action " HTTP header field value
** ).
lo_http_client->get_last_error( importing message = lv_message ).
"STEP-3 : SEND HTTP REQUEST
call method lo_http_client->send
exceptions
http_communication_failure = 1
http_invalid_state = 2.
*-----------------------------------------------------------------
"STEP-4 : GET HTTP RESPONSE
call method lo_http_client->receive
exceptions
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3.
"STEP-5 : Read HTTP RETURN CODE
call method lo_http_client->response->get_status
importing
code = http_status_code
reason = status_text.
"STEP-6 : READ RESPONSE DATA
call method lo_http_client->response->get_cdata
receiving
data = w_result.
call method lo_http_client->response->get_data
receiving
data = w_result. " Binary data
data lt_data type srt_xml_data_tab.
call function 'SRTUTIL_CONVERT_XML_TO_TABLE'
exporting
xdoc = w_result
importing
data = lt_data.
call method lo_http_client->close
exceptions
http_invalid_state = 1
others = 2.
Error Screen in Get_data IT_DATA.