Sap Abap Bsp HTTP Get & Post Request Metod

Paylaş.

SAP Forum 2012 yeni bir yarış

SAP HTTP Request

 

 

 

 

 

DATA:   http_client    TYPE REF TO if_http_client ,
http_url       TYPE string                ,
p_content      TYPE string                .

CALL METHOD cl_http_client=>create_by_url
EXPORTING
url                = ‘http://scn.sap.com/welcome’
*   proxy_host         =
*   proxy_service      =
*   ssl_id             =
*   sap_username       =
*   sap_client         =
IMPORTING
client             = http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active  = 2
internal_error     = 3
OTHERS             = 4.

http_client->request->set_header_field( name  = ‘~request_method’
value = ‘GET’ ).
* Send the request
http_client->send( ).

* Reterive the result
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state         = 2
http_processing_failed     = 3
OTHERS                     = 4.

p_content = http_client->response->get_cdata( ).

” Tag Replacemnt

REPLACE  ALL OCCURRENCES OF ‘&lt;’ IN p_content WITH ‘<‘ .
REPLACE ALL OCCURRENCES OF ‘&gt;’ IN p_content WITH ‘>’ .
write p_content .

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)