on 09-18-2014 4:15 PM
Hi Experts,
I have a scenario where i need to push JSON to cross domain service URL through Http response in SAP ICF service.
I am using interface-IF_HTTP_EXTENSION to push json to other service.
Regards,
Sid
Have a look at page 12 of the following document:
http://help.sap.com/businessobject/product_guides/sbo41/en/sbo41_bip_rest_ws_en.pdf
Dan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
Thanks for your faster reply.But it not addressing my issue so i have given sample code for your better understanding.
METHOD if_http_extension~handle_request.
* Variables
DATA: l_verb TYPE string,
l_path_info TYPE string,
l_resource TYPE string,
l_param_1 TYPE string,
l_param_2 TYPE string.
* Retrieving the request method (POST, GET, PUT, DELETE)
l_verb = server->request->get_header_field( name = '~request_method' ).
* Retrieving the parameters passed in the URL
l_path_info = server->request->get_header_field( name = '~path_info' ).
CLEAR: ls_contact,ls_response,l_rc.
* Retrieve form data
ls_contact-email = server->request->get_form_field('empno').
ls_contact-firstname = server->request->get_form_field('name').
ls_contact-lastname = server->request->get_form_field('phone_no').
CREATE OBJECT lo_json_serializer
EXPORTING
DATA = ls_contact. " Data to be serialized
* Serialize ABAP data to JSON
CALL METHOD lo_json_serializer->serialize.
* Get JSON string
CALL METHOD lo_json_serializer->get_data
RECEIVING
rval = lv_json.
* Sets the content type of the response
CALL METHOD server->response->set_header_field( name = 'Content-Type'
value = 'application/json; charset=iso-8859-1' ).
* Returns the results in JSON format
CALL METHOD server->response->set_cdata( data = lvjson ).
Note: I want to send the JSON (lv_json) to cross domain service URL(http:localhost:8080/new/data) using post method.
ENDMETHOD.
Regards,
Sid
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.