"service": "com.sap.bpm.rule",
"endpoint": "rule_runtime_url",
/** @type {{ Greeting: string, Addressee: string }} */
{
"Greeting": "Hello",
"Addressee": "world"
}
{
"Result": [
{
"MyHtml5appConfiguration": {
"Greeting": "Hello",
"Addressee": "world"
}
}
]
}
"config": {
"type": "sap.ui.model.json.JSONModel",
"settings": {
"ruleServiceId": "<your rule service ID> e.g. 998bdc940a274cabaa8dcc5cc77abcde"
}
},
loadConfigModelAsync: function (component) {
let config = component.getModel("config");
config.setDefaultBindingMode(sap.ui.model.BindingMode.OneWay);
const ruleServiceId = config.getProperty("/ruleServiceId");
if (ruleServiceId) {
// Get XSRF token:
// Match with route "^/business-rules-runtime/(.*)$" in xs-app.json, and API definition at [1]:
// [1] https://api.sap.com/api/SAP_CF_BusinessRules_Runtime_V2/resource
$.ajax({
url: "./business-rules-runtime/rules-service/rest/v2/xsrf-token",
headers: { "X-CSRF-Token": "Fetch" }
}).then(function (data, textStatus, jqXHR) {
const csrfToken = jqXHR.getResponseHeader('X-CSRF-Token');
// Get the configuration.
// JavaScript snippet from the API Business Hub:
var oRequestData = {
"RuleServiceId": ruleServiceId,
"Vocabulary": [{ "InputElement": true }]
};
$.ajax({
// url: "./business-rules-runtime/rules-service/rest/v2/rule-services",
url: "./business-rules-runtime/rules-service/rest/v2/workingset-rule-services",
method: "POST",
headers: {
"DataServiceVersion": "2.0",
"Accept": "application/json",
"Content-Type": "application/json",
"x-csrf-token": csrfToken
},
data: JSON.stringify(oRequestData),
dataType: "json"
}).then(function (data, textStatus, jqXHR) {
// Log = sap/base/Log
Log.debug("loaded configuration from business rules service");
//
if (data.Result[0]) {
config.setData(data.Result[0], true);
} else {
Log.error(`unexpected data received: ${JSON.stringify(data)}`);
}
}, function (jqXHR, textStatus, errorThrown) {
Log.error(jqXHR.responseText);
});
}, function (jqXHR, textStatus, errorThrown) {
Log.error(jqXHR.responseText);
});
}
}
// Load the configuration
models.loadConfigModelAsync(this);
"{config>/MyHtml5appConfiguration/Greeting}, {config>/MyHtml5appConfiguration/Greeting}!"
- name: ovh.lkajan.blogpost-business-rules-svc
type: org.cloudfoundry.managed-service
parameters:
service: business-rules
service-plan: lite # Choose 'basic' for non-trial use.
modules:
- name: ovh.lkajan.blogpost-destination-content
type: com.sap.application.content
requires:
# [...]
- name: ovh.lkajan.blogpost-business-rules-svc
parameters:
service-key:
name: ovh.lkajan.blogpost-business-rules-svc-key
parameters:
content:
instance:
destinations:
# [...]
- Name: ovh_lkajan_blogpost_business_rules_svc
Authentication: OAuth2ClientCredentials
ServiceInstanceName: ovh.lkajan.blogpost-business-rules-svc
ServiceKeyName: ovh.lkajan.blogpost-business-rules-svc-key
resources:
# [...]
- name: ovh.lkajan.blogpost-business-rules-svc
type: org.cloudfoundry.managed-service
parameters:
service: business-rules
service-plan: basic
"routes": [
{
"source": "^/business-rules-runtime/(.*)$",
"target": "/$1",
"service": "com.sap.bpm.rule",
"endpoint": "rule_runtime_url",
"authenticationType": "xsuaa"
},
...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
17 | |
10 | |
7 | |
7 | |
5 | |
4 | |
4 | |
4 | |
4 |