In OPA the rulebase can be executed/invoked by Oracle Web Determinations and Oracle Determinations Server, the latter is the web service creation using WSDL. There is specific and generic WSDL’s created and the user can access the best suitable WSDL format as per the project requirement. When you first create a rulebase in OPA and if you try to build and run using the Oracle Determinations Server you may not be able to find the Specific WSDL in the output screen for accessing the rulebase. Well, this little problem can be solved using a simple trick. Today I am going to show you how to generate specific WSDL for an OPA rulebase in Oracle Determinations Server.
How to Generate Specific WSDL for an OPA Rulebase – Example Tutorial
First, fire up the Oracle Policy Modeling tool. Create a new project named WSDL_Generation.
Create a new word document under the rules folder. For that, right click on the rules fo lder and select ‘Add new word document’
Now double click on the word document you have just created and write the following rule and compile it.
the person is eligible for driving if
the person has a valid license
In this case the attributes and the conclusion of the rule is created automatically and programmer doesn’t have to add it automatically. There is disadvantage to this technique and that is, only generic WSDL will be created not the specific one. Let’s build and run this using the Determinations server.
This is because the Oracle Policy Modeling tool will not assign public names (unique name to identify) to the attributes created. Public name is very important when you generate specific WSDL as it is a unique name assigned to each attributes in the WSDL.
So, How to add public names for the attributes. In OPM we have the concept called properties file and this file is used to manage the attributes used in the rule doc.
To create a properties file, Go to OPM, right click on properties folder –> Select Add New Properties File.
Name the file and open the file. Right click on the empty space and select ‘Add attribute’.
Go back to the word rule doc and select the text in conclusion except the word ‘if’.
Now it is very important to copy paste the text exactly as in the doc. You can give any name as public name. Our conclusion is a boolean attribute so we have selected the Data Type as boolean.
The next attribute is ‘the person has a valid license’ which we can add via the word document. I think its a bug in the OPA word plugin that we cannot add the first attribute as boolean. The drop down doesn’t have boolean type in it. See the screenshot of me trying to add ‘the person is eligible for driving’ via word document. That’s why we are adding it by creating the properties file and through the OPM tool.
This won’t be an issue if you try adding the second attribute. Select the second attribute and click the ‘Add attribute’ option. Now you can select the boolean data type. You also need to specify the file to which you are going to add this attribute. It is important to give the Public name also.
PS: If you encounter an error like ‘An attribute with this text already exist’ then you can go to the OPM properties file and delete it and try again.
Now build and run using the determinations server and you will see this on browser;
The link list has links for the Specific WSDL also. If it is not getting generated trouble shoot yourself by checking whether you have created public names and properties file entry for all the attributes you are using in the rulebase.
Feel free to contact me if you have any trouble. Like us on Facebook and Subscribe for free email news letters. Thank you for reading.