当前位置:网站首页>ABAP implementation publishes restful services for external invocation example
ABAP implementation publishes restful services for external invocation example
2022-04-23 09:32:00 【rogerix4】
1. Create implementation classes
- Transaction code :SE24
- Set the interface to be implemented :IF_HTTP_EXTENSION
2. Implementation class
-
The main implementation methods :IF_HTTP_EXTENSION~HANDLE_REQUEST
-
Implementation code :
METHOD if_http_extension~handle_request. TYPES: BEGIN OF ty_input, rows TYPE i, END OF ty_input. DATA: l_input TYPE ty_input. DATA: i_string TYPE string, o_string TYPE string. "Get Importing Json i_string = server->request->if_http_entity~get_cdata( )." "Deserialize Json to data /ui2/cl_json=>deserialize( EXPORTING json = i_string CHANGING data = l_input ). "Get Return Data SELECT * FROM sflight INTO TABLE @DATA(lt_sflight) UP TO @l_input-rows ROWS. "Serialize Data to Json o_string = /ui2/cl_json=>serialize( lt_sflight ). "Set the return data format CALL METHOD server->response->if_http_entity~set_content_type EXPORTING content_type = 'application/json'. "set exporting data server->response->set_cdata( EXPORTING data = o_string ). ENDMETHOD.
3. Definition RESTful service
- Transaction code :SICF
- New child element
- Set the service processor
- Set default login information ( If not set , Accessing data requires SAP Account authentication )
- Activate service
4. Test service
- Directly test whether the service is accessible
- Using third-party tools APIPost SoaUI test
- Set up Json Query data
- Set up SAP Account authentication (SICF Use when the default authentication account is not set )
- Send a request , Get the return data
- Set up Json Query data
版权声明
本文为[rogerix4]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230623503879.html
边栏推荐
- Cloud computing competition -- basic part of 2020 competition [task 3]
- JS DOM learn three ways to create elements
- web页面如何渲染
- Codeforces Round #784 (Div. 4)
- DVWA range practice record
- Go language learning notes - exception handling | go language from scratch
- Node installation
- JSON input of Chapter 14 of kettle paoding jieniu
- [Luke V0] verification environment 2 - Verification Environment components
- 机器学习(六)——贝叶斯分类器
猜你喜欢
JS DOM event
Detailed explanation of delete, truncate and drop principles in MySQL database
重载、重写、隐藏的对比
Secrets in buffctf file 1
Practice of Flink streaming batch integration in Xiaomi
Machine learning (VI) -- Bayesian classifier
Go language learning notes - slice, map | go language from scratch
Using JS to realize a thousandth bit
How to obtain geographical location based on photos and how to prevent photos from leaking geographical location
DVWA range practice
随机推荐
Project upload part
Practice of Flink streaming batch integration in Xiaomi
SQL used query statements
How to protect open source projects from supply chain attacks - Security Design (1)
Kettle实验 转换案例
JS case to find the maximum value, reverse the array, bubble sort
Comparison of overloading, rewriting and hiding
MySQL of database -- overview and installation
npm ERR! network
Get trustedinstaller permission
web页面如何渲染
《數字電子技術基礎》3.1 門電路概述、3.2 半導體二極管門電路
亚马逊云科技入门资源中心,从0到1轻松上云
2D 01 Backpack
SAP debug debug for in, reduce and other complex statements
Kernel PWN learning (3) -- ret2user & kernel ROP & qwb2018 core
Yyds dry goods inventory ubuntu18 0.4 install MySQL and solve error 1698: access denied for user ''root' '@' 'localhost' '
[C language] document operation
Kernel PWN learning (4) -- double fetch & 0ctf2018 baby
Program, process, thread; Memory structure diagram; Thread creation and startup; Common methods of thread