Добрый день! У кого есть опыт интеграции с SharePoint через HTTP?
Пытаюсь выполнить GET запрос, выходит
Application Server Error 500 Native SSL error Error is logged with Tag: {0022fb4a} Thu Oct 11 09:38:29 2018
Code:
CONSTANTS
: gc_user TYPE string VALUE 'UserTest'
,gc_password TYPE string VALUE 'UserPass'
.
DATA
: lv_method TYPE string
,lv_response TYPE xstring
.
lv_method = 'GetByTitle(' && |'| && 'Test' && |'| && ')/items' .
PERFORM send_get_method
USING lv_method
abap_true
CHANGING lv_response .
*&---------------------------------------------------------------------*
*& Form send_get_method
*&---------------------------------------------------------------------*
* Вызов GET метода сервиса
*----------------------------------------------------------------------*
* -->IV_METHOD Метод
* -->IV_SHOW Показать ответ
* <--CV_RESULT Ответ
*----------------------------------------------------------------------*
FORM send_get_method
USING iv_method TYPE string
iv_show TYPE abap_bool
CHANGING cv_result TYPE xstring .
CONSTANTS
: lc_portal TYPE string VALUE 'test.ru'
,lc_content_type TYPE string VALUE 'application/json'
,lc_header_name TYPE string VALUE 'accept'
,lc_header_value TYPE string VALUE 'application/json;odata/verbose'
,lc_type_auth TYPE i VALUE 1
.
DATA
: lo_http_client TYPE REF TO if_http_client
,lv_service TYPE string
,lv_result TYPE xstring
.
lv_service = 'https://'
&& lc_portal
&& '/_api/web/lists/'
&& iv_method .
" Формирование объекта соединения с сервисом через REST /
cl_http_client=>create_by_url(
EXPORTING url = lv_service
IMPORTING client = lo_http_client
EXCEPTIONS argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 9 ).
DO 1 TIMES.
" Установить метод соединения
lo_http_client->request->set_method(
EXPORTING method = if_http_request=>co_request_method_get ).
" Протокол соединения
lo_http_client->request->set_version(
EXPORTING version = if_http_request=>co_protocol_version_1_1 ).
" Определение типа контента обмена
lo_http_client->request->set_content_type(
EXPORTING content_type = lc_content_type ).
" Заголовок соединения
lo_http_client->request->set_header_field(
EXPORTING name = lc_header_name
value = lc_header_value ).
" Аутенфикация
lo_http_client->request->set_authorization(
EXPORTING auth_type = lc_type_auth
username = gc_user
password = gc_password ) .
" Отправление
lo_http_client->send(
EXCEPTIONS http_communication_failure = 1
http_invalid_state = 2
OTHERS = 9 ).
" Получение ответа: ожидание
lo_http_client->receive(
EXCEPTIONS http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 9 ).
" Получение ответа: XML response
lv_result = lo_http_client->response->get_data( ).
ENDDO.
IF sy-subrc NE 0.
MESSAGE 'Ошибка обращения к сервису'
TYPE 'S'
DISPLAY LIKE 'E'.
RETURN.
ENDIF.
" Отображение ответа
IF iv_show EQ abap_true.
CALL FUNCTION 'SRTUTIL_HELPER_XML_SHOW'
EXPORTING
xdoc = lv_result
html = abap_false.
ENDIF.
cv_result = lv_result.
ENDFORM. "send_get_method