当前位置:网站首页>AS400 API 从零到一的整个历程
AS400 API 从零到一的整个历程
2022-07-01 01:08:00 【Saidywin】
简单的分享,如果有不一样的见解可以一起讨论
1)AS400上安装对应的577ODG1 这个软件
如果你不知道有没有装,你可以通过
GO LICPGM 这个命令,10 去看到哪些安装的软件

怎么安装具体如下:
1. To install the libraries, run the command go licpgm

2. Select option 11 to install a Licensed Program and install option 39

如果发现有IBM HTTP Server For I
2)启动 HTTP 服务,这是基本要求。
STRTCPSVR *HTTP HTTPSVR(*ADMIN)
192.168.88.249 是AS400 的IP 地址
http://192.168.88.249:2001/HTTPAdmin
如果说你的User没有权限去登录Admin, 需要给User profile *ALLOBJ and *IOSYSCFG的权限去创建服务器


因为Web服务是需要指定对应的user profile但是如果是个人的user profile是有密码过期的这样就会导致你的user 密码过期后面API 服务不能用了。所有要create 一个永久不过期的用户:
CRTUSRPRF USRPRF(IWSREST02) PASSWORD(*NONE)


3)服务器create 成功后接下来就是部署rest API 服务

部署服务的时候可以选择SRVPGM 和 PGM
Produce的形式:
h nomain PGMINFO(∗PCML:∗MODULE)
d ConvertTemp pr
d tempIn 10 const
d tempOut 10
p ConvertTemp b export
d ConvertTemp pi
d tempIn 10 const
d tempOut 10
d tempI s 8P 2
d tempO s 8P 2
d value S 50A
/free
value = %STR(%ADDR(tempIn));
tempI=%DEC(value:7:2);
tempO = (5/9)∗(tempI - 32);
value = %CHAR(tempO);
tempOut = value;
%STR(%ADDR(tempOut):10)=tempOut;
/end-free
p ConvertTemp e
PGM 的形式:
/free
ctl-opt *debug(yes) PGMINFO(∗PCML:*DCLCASE:∗MODULE);
dcl-f custpf usage(*update) keyed
rename(TESTPFR:NEWNAME) USROPN ;
dcl-s k1cust like(CUBK) INZ(1);
dcl-ds w1request INZ qualified;
customer char(10);
customername char(10);
end-ds W1reqeust;
dcl-pi *n;
// request
customerds likeds(w1request);
//response
statuscode int(5);
end-pi;
exsr sr100;
eval *INLR = *ON;
return;'
// ==================================================
begsr SR100;
OPEN NEWNAME;
eval k1cust = w1request.customer;
Chain k1cust NEWNAME;
If %found(NEWNAME);
eval custname =w1request.customername;
update NEWNAME;
eval statuscode = 200;
else;
eval statuscode = 400;
endif;
Close NEWNAME;
endsr;
// ==================================================
/end-free
但是记得如果说要让IWS 识别到对应的SRVPGM或者PGM
是需要在 H Spec 定义,不然识别不到
H PGMINFO(∗PCML:∗MODULE)

API服务给到名字
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nKNKCH1T-1656494130334)(https://mmbiz.qpic.cn/mmbiz_png/WxKgPiboJnT3CMr74DI8WmNj5DDvcQHnQxwsCAdwevG10PbOdLmcnfDTcsREWcajaX0ic41R7zmibv2Ck1M8bibGdg/640?wx_fmt=png)]

选择对应的方法

加好library list

部署成功

属性显示 基本资源 URL:
http://192.168.88.249:10021/web/services/fto
停 WEB 服务
ENDTCPSVR SERVER(*HTTP) HTTPSVR(IWSREST02)
需要Debug API Job
Subsystem QUSRWRK
Job QZRCSRVS
STRSRVJOB 去然后STRDBG debug 到对应的API 后台QZRCSRVS job,记得SRVPGM 是不可以Debug的,只要部署的时候是Program的时候才可以
GET、POST、PUT、DELETE
GET 和Delete 是只能用Path_Parm 或者query_Parm 是不可以用Body的

说完了部署API 的服务,接下来就是需要对API服务进行SSL 的配置
配置SSL/TLS设置
配置机器使用SSL/TLS可以启用加密通信。这样做有助于防止数据在传输过程中被截获、破解或篡改。

使用自签证书时的配置流程
创建和安装设备证书:
IBM 主要是通过 iKeyman
启用SSL/TLS:
配置SSL
重启服务器

SSL的IBM 的SSL 主要是用iKeyman 生成 密钥:
How do I extract certificates from key databases using the iKeyman utility?
https://www.youtube.com/watch?v=aFUF8KAaMIQ
How do I receive a signed certificate from a certificate authority using the iKeyman utility?
https://www.youtube.com/watch?v=Wq1ftCAow9Y
边栏推荐
- Log4j2 threadcontext log link tracking
- 软件测试的可持续发展,必须要学会敲代码?
- 3500字归纳总结:一名合格的软件测试工程师需要掌握的技能大全
- Strictmode analysis activity leakage -strictmode principle (3)
- laravel Carbon 时间处理类使用
- Log logrus third party library usage
- 视频教程 | 长安链推出系列视频教程合集(入门)
- The argument type 'function' can't be assigned to the parameter type 'void function()‘
- After working for 6 years, let's take stock of the golden rule of the workplace where workers mix up
- Basic knowledge II - Basic definitions related to sta
猜你喜欢

数据探索电商平台用户行为流失分析

45 year old programmer tells you: why do programmers want to change jobs? It's too true

农产品换房?“变相”购房补贴!

Understanding and application of Qt5 layout in creation

那些一门心思研究自动化测试的人,后来怎样了?

PHP crawls data through third-party plug-ins

For the sustainable development of software testing, we must learn to knock code?

Unknown database connection database error

Unknown database连接数据库错误

3500 word summary: a complete set of skills that a qualified software testing engineer needs to master
随机推荐
工作6年,来盘点一下职场人混迹职场的黄金法则
Basic knowledge II - Basic definitions related to sta
1500w播放下还藏着什么热点?B站2个未来趋势你不得错过
Relationship between ASCII, Unicode, GBK, UTF-8
Strictmode analysis activity leakage -strictmode principle (3)
【多源bfs】934. Shortest Bridge
[Qt5 basic \u 1] starting from 0, Mr. Detian will study with you - Introduction to the window
Visual studio 2019 Download
【Proteus仿真】Arduino UNO +74C922键盘解码驱动4X4矩阵键盘
微生物健康,食品微生物检测为什么很重要
医疗HIS行业短信发送解决方案
PHP converts two-dimensional array elements into key value pairs
AS400 大厂面试
测试必备工具-Postman实战教程
Open3d point cloud bounding box
Mathematical knowledge: 01 sequence satisfying conditions - find combinatorial number
opencv -- 笔记
【动态规划】路径dp:931. Minimum Falling Path Sum
System settings large page
数学知识:求组合数 III—求组合数