Invoking Business Rules Part 2
This blog is a continuation to the Invoking Business Rules – Part 1 – “Invoking Business Rules – Part 1”- on how business rules can be evaluated.
The scenario considered is the same as before – i.e., you have already created a rules project. And that the rules project created here makes use of a XSD as its business object.
In the previous blog I have already mentioned one way of invoking rules i.e., look-up the rule engine EJB in your application. The second way in which rules can be used is by exposing the ruleset as a webservice and then using this webservice when required in the application.
To help you in generating a webservice for a ruleset easily, a web service generator tool has been provided in the SAP NetWeaver Business Rules Management Resources Center of the SDN. The link to this tool is – http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10c6b0c3-0c50-2b10-97ac-e98ad72aaf8f. The tool is available in as a zip.
[One needs to note that this is an unsupported tool and is not a product feature as of yet. This is provided as an aid to developers to quickly create an XML service for Rules. This is equivalent to creating a Web service using a code based approach.]
The Rules Tutorial Center also has link to an article which will help you in generating the web service manually i.e., by using a code based approach. (http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c082390a-035f-2b10-dc9d-befec4aff998)
Once this tool is downloaded from the given location, you need to make sure that the tool is configured correctly. The tool has to be configured in the run.bat file available in the zip. Here, you need to mention information regarding –
JAVA_HOME (we need to set the path to the jdk to this variable)
JDI_WORKSPACE(we need to set the path to the workspace to this variable)
Once these changes have been made, there are few prerequisites specified which needs to be satisfied. The workspace –
needs to have at least one Web Module or J2EE DC (any dummy DC will also do)
atleast one DC in the workspace needs to reference BRMS FAÇADE
atleast one DC in the workspace needs to reference ENGFACADE/tc/bl/logging/api
atleast one DC in the workspace needs to reference JEE Engine Façade
The next step is to use this tool to generate the web service. Mr. Velu has mentioned the steps to be performed to do this, very clearly in one of his blogs. The link to this in-detail blog, written by Mr.Velu is – Generate and Test your SAP Netweaver BRM Rules Web Service – Part 1