sap-tutorials / Tutorials

Tutorials on sap.com
https://developers.sap.com/tutorial-navigator.html
Creative Commons Attribution 4.0 International
727 stars 774 forks source link

Test the Business Rules API from SAP API Business Hub #5035

Closed veeraa83 closed 4 years ago

veeraa83 commented 4 years ago

Tutorial URL: https://developers.sap.com/tutorials/cp-cf-businessrules09-test-apis.html

in this step - Step 4: Observe the API response

I receive the below response, when I sent the payload as given in step# 3 Response { "Result": [] }

Request Payload: { "RuleServiceId": "", "Vocabulary": [ { "Employee": { "isFullTimeEmployee": true, "countryofCompany": "USA", "jobTitle": "Engineer II", "company": "2000" } } ] }

VandanaVasudevan commented 4 years ago

Hi,

The payload is correct. Can you send me a snapshot of your DetermineEquipmentRules decision table? or cross-check if the values entered in the decision table are correct?

Best Regards, Vandana

veeraa83 commented 4 years ago

Hi Thanks for the very quick response.I verified once again but could not find out an issue in the decision table. Attaching a snapshot here. Could you please help me identify the issue?

Thanks in advance. DetermineEquipmentRule1 DetermineEquipmentRule2

2) Also, I would like to know if the UI used for maintaing the business rules which we deployed SCP (https://-dev-businessruleseditor-approuter.cfapps.eu10.hana.ondemand.com/comsapbpmrule.ruleeditor/index.html#//Projects) shall this remain the same in actual scenario, I would like to know whether cloud developers need to develop a UI for maintaining these rules for business users or it is the standard UI that can be used in a production scenario as well. If not is there any low level API to develop the UI for business rules maintainence. 3) when we deploy a business rule after activating it in the Manage Project Application, where is it getting deployed?. I do not find any new application in SAP cloud platform cockpit after the deployment. If this is not the correct forum to raise these doubts,can you please point me to the place where can ask these questions. Since these are not clearly explained in the tutorials, raising them here. Thanks

VandanaVasudevan commented 4 years ago

Hi,

Do you mind sharing your project zip file with me? You can export the project to your local system using the steps in this link: Export a Project

  1. This is the standard UI that is available in the production scenario too.

  2. When we deploy a rule service, it gets deployed to the SAP Cloud Platform (in this case). You can also deploy it to other systems if you configure it. In short, a rule service should be deployed first before invoking it. In this tutorial, we are invoking the rule service using API Business Hub to automate the decision scenario. In a bigger picture, when Business Rules is embedded as a part of a custom application, the rule service should be deployed to the system (For example, SAP Cloud Platform) and invoked to implement the decision logic in your custom application. You can also refer to the Business Rules documentation for more information on the service: SAP Cloud Platform Business Rules

veeraa83 commented 4 years ago

Hi Thanks for your quick reply. I have uploaded the project here. I have tried another scenario with decision table(ProductDiscountRuleService) and it is working fine.

DetermineEquipment01.zip Thanks for your clarification. I deployed the file businessruleseditor_0.0.1.mtar from web IDE as mentioned in the tutorial. so in my trial version, inside the dev space, I could only see one application deployed with the name businessruleseditor_appRouter.(PFA the screenshot app.JPG) appAfter this even if I create any number of rule services inside the Mange Projects UI, I do not see them in this location. I raise this point, since if the deployment of a rule service is as deploying any application from web IDE to cloud platform, then the business user should also be provided with the same authorizations.

ArchanaShukla commented 4 years ago

Hello Veera, Here are the answers to your questions:

  1. Your payload to test rules is not according to your data object. In your payload you have used isFullTimeEmployee but in your data object you have used IsFullTimeEmployee attribute. In such case, rule engine does not find any matching condition and it return an empty value. Also, I see that your rule-service Id is not defined in your payload, in that case rule engine does not know which rule service to invoke.

  2. Manage Rule Projects application is a standard pre-delivered app-router based application that one needs to set it up in their respective cloud accounts - trial or factory. Entire life cycle of the business rules projects is maintained and managed from this Manage Rule Project app. Business rules project is the container for all design time artefacts of rules like data objects, rule services, rules and rulesets. Everything you create in manage rules application is persisted in the data base maintained by the business rules provider accounts and consumers do not have access to it. This is pretty much standard for all cloud services.

  3. When you deploy the rule service, it becomes available to consumption only via public REST APIs. There is currently no way to see these deployed rule services. When you deploy the rule service it will not be available in under applications in the CF cockpit coz it is not an CF application instead it's a runtime object that can be consumed only via public APIs. All the APIs (design time and runtime) are available in API Business Hub (https://api.sap.com)

Please read more in the documentation , learning journey or several blogs published by us. It is not possible to explain things in detail in tutorials.

MichaelCzcz commented 4 years ago

Thank you for your feedback. The issue seems to be resolved, so I am closing the issue.

If you still have questions, feel free to reopen the issue.