Code: Alles auswählen.
REPORT z_aze_webservice.
*&---------------------------------------------------------------------*
*& Beispiel f. Webservice by Aze
*&---------------------------------------------------------------------*
DATA: http_client TYPE REF TO if_http_client ,
http_url TYPE string ,
p_inhalt TYPE string .
* URL Parameter festlegen
http_url = 'http://www.abapforum.com/getwhatever.asmx?Parameter=XYZ'.
* Neues http objekt
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = http_url
IMPORTING
client = http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.
* request methode auf get setzten
http_client->request->set_header_field( name = '~request_method' value = 'GET' ).
* Request an Webservice senden
http_client->send( ).
* Response abfragen
CALL METHOD http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
* Daten als String abholen
p_inhalt = http_client->response->get_cdata( ).