- 如何在 SAP BTP 上创建以及消费 Business Rul
- SAP HANA Cloud 学习教程之二: 如何往SAP BT
- Fiori-like Prototype ( 2021 SAP
- Fiori-like Prototype ( SAP BTP 2
- SAP BTP 上 workflow 和 Business Se
- 在 CloudFoundry 环境下开发 multitenant
- 使用 cf push 部署应用到 SAP BTP 时遇到错误消息
- Fiori-like Prototype ( 2021 SAP
- 在 SAP BTP 里使用 SAP HANA Cloud 试用版
- 如何在 ABAP Development Tool 创建新的 A
官网链接:https://developers.sap.com/tutorials/cp-cf-businessrules07-ruleservice-ruleset.html
Create a rule service interface for an application to invoke the decision logic by associating the rule to a ruleset of the rule service.
创建 rule service interface 的目的:应用程序通过将规则与规则服务的规则集相关联来调用决策逻辑。
A rule service is an interface or an end point that enables an application to invoke a decision logic.
rule service 可以看成一个接口或者 endpoint,应用程序通过调用 rule service,可以触发 decision logic.
Rule set 是一系列 rule 的集合,工作于某个特定的场景。
A rule set can be linked to a rule service so that the set of rules in the rule set gets executed when the rule service is deployed.
规则集可以链接到规则服务,以便在部署规则服务时执行规则集内包含的所有规则。
创建一个新的 rule service:
![](https://img.haomeiwen.com/i2085791/f1e4d9f391fa5295.png)
从下拉菜单里选择 vocabulary:
![](https://img.haomeiwen.com/i2085791/accd64aa49eafb58.png)
语义是:通过 Employee 信息作为输入,决策出 EquipmentInfo 作为决策结果:
![](https://img.haomeiwen.com/i2085791/6c76506f2b777dfe.png)
创建另一个 rule service,用于决策是否需要 approval:
![](https://img.haomeiwen.com/i2085791/f84a05e543e27fb5.png)
![](https://img.haomeiwen.com/i2085791/264c52c37998158a.png)
激活整个项目:
![](https://img.haomeiwen.com/i2085791/b99c0bc0b19fe75c.png)
点击 Deploy 按钮,部署 rule service:
![](https://img.haomeiwen.com/i2085791/37f82b0ed7da2b6c.png)
如果部署失败,检查该 Rule Service 使用到的 entity 是否已经激活,或者是否已经添加到 Ruleset vocabulary 里:
![](https://img.haomeiwen.com/i2085791/273e804ace15d0d8.png)
很明显,这个 Equipment 维护错了,应该修改成 Employee:
![](https://img.haomeiwen.com/i2085791/6df60532a7c12571.png)
SAP API Business Hub 上找到 SAP Business Rules Service:
![](https://img.haomeiwen.com/i2085791/837bcb3d0ff35a06.png)
使用 Rule Execution API for Cloud Foundry 调用 Business Service:
![](https://img.haomeiwen.com/i2085791/641f5307f1e84e6f.png)
给 wm_businessrules 创建一个新的 service key:
![](https://img.haomeiwen.com/i2085791/9458d4c5d6624284.png)
![](https://img.haomeiwen.com/i2085791/ee47b2dcb0d98d51.png)
![](https://img.haomeiwen.com/i2085791/4ffa4e33bb756b29.png)
抄下 clientid, clientsecret 和 url 字段,作为 SAP API Business Hub 里维护 environment 的输入值:
![](https://img.haomeiwen.com/i2085791/1756d083a0594ad6.png)
消费该 business rule service 的输入 payload:
{
"RuleServiceId": "f27730d10cce4525ae111e647054d8f7",
"Vocabulary": [
{
"Employee": {
"IsFullTimeEmployee": true,
"countryofCompany": "USA",
"jobTitle": "Engineer II",
"company": "2000"
}
}
]
}
更多Jerry的原创文章,尽在:"汪子熙":
![](https://img.haomeiwen.com/i2085791/97c4752c0e619c44.png)
网友评论