Code: Alles auswählen.
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = url
IMPORTING
client = client
EXCEPTIONS
argument_not_found = 1
internal_error = 2
plugin_not_active = 3
OTHERS = 4.
IF sy-subrc <> 0.
WRITE: / 'create failed, subrc = ', sy-subrc.
EXIT.
ENDIF.
client->request->set_header_field( name = '~request_method'
value = 'POST' ).
CALL METHOD client->request->set_method(
if_http_request=>co_request_method_get ).
CALL METHOD client->send
EXPORTING
timeout = timeout
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL METHOD client->get_last_error
IMPORTING
code = subrc
MESSAGE = errortext.
WRITE: / 'communication_error( send )',
/ 'code: ', subrc, 'message: '.
EXIT.
ENDIF.
CALL METHOD client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
CASE sy-subrc .
WHEN 1.
error_msg = 'http_communication_failure'.
WHEN 2.
error_msg = 'http_invalid_state'.
WHEN 3.
error_msg = 'http_processing_failed'.
WHEN OTHERS.
error_msg = 'other http error'.
ENDCASE.
ENDIF.
* Return Code ist 200, Status OK
**************************************
client->response->get_status( IMPORTING code = http_status_code
reason = http_message ).
" Im Debugger kann ich hier die Login Seite sehen
**********************************************************
l_rstringx = client->response->get_cdata( ).
wa_im_form_fields-name = 'user'.
wa_im_form_fields-value = 'XXXX'.
APPEND wa_im_form_fields TO it_im_form_fields.
wa_im_form_fields-name = 'passwd'.
wa_im_form_fields-value = 'XXXX'.
APPEND wa_im_form_fields TO it_im_form_fields.
* hier der Versuch die Felder auf der Website zu füllen
***************************************************************
client->request->set_form_fields( it_im_form_fields ).
CALL METHOD client->send
EXPORTING
timeout = timeout
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
CALL METHOD client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
client->response->get_status( IMPORTING code = http_status_code
reason = http_message ).
* Im Debugger kann ich hier die Login Seite sehen. Leider ohne übergebene Werte
************************************************************************************************
l_rstringx = client->response->get_cdata( ).
CALL METHOD client->close
EXCEPTIONS
http_invalid_state = 1
OTHERS = 2.