Test a rulebase using a web service

What do you want to do?

Find out the installed version of Determinations Server

Find out what rulebases are deployed on the Determinations Server

Use soapUI to test a rulebase

Create and execute an Assess operation

 

 

To import the Determinations Server WSDL into soapUI, do the following:

  1. Make sure that the Determinations Server is running
  2. Start soapUI
  3. Choose File > New soapUI project and give the project a name of your choice, but for the initial WSDL/WADL, put the WSDL for the Determinations Server. For java this will be http://<server>:<port>/determinations-server/server/soap?wsdl and for .NET this will be http://<server>:<port>/determinations-server/server/soap.asmx?wsdl
  4. Click OK

 

 

soapUI will create a new project and import the WSDL into that project giving you a service definition named odsServer. If you left the option Create sample requests for all operations on, you will have a sample operation for the three Determinations Server Service Operations: GetServerInfo, ListRulebases and LoadRulebase.

If an error occurred, it is probably because the Initial WSDL URL is incorrect.

 

Find out the installed version of Determinations Server

  1. Make sure that the Determinations Server is running
  2. On the left hand side of soapUI, go to the GetServerInfo operation and expand it so you can see Request 1. Double-click on that request to open it. Notice that the request has been created by soapUI. Because there are no parameters needed for a GetServerInfo operation, you can run this operation without modification. To run this operation, click on the green arrow in the top lefthand corner of the request panel.
  3. The response should appear in the right hand panel. The GetServerInfo information returns versions for: the Determinations Server, the Determinations Engine, the Interview Engine, and the time zone that Determinations Server is using.

Find out what rulebases are deployed on the Determinations Server

  1. Make sure that the Determinations Server is running
  2. On the left hand side of soapUI, go to the ListRulebases operation and expand it so you can see Request 1. Double-click on that request to open it. Notice that the request has been created by soapUI. Because there are no parameters needed for a ListRulebases operation, you can run this operation without modification. To run this operation, click on the green arrow in the top lefthand corner of the request panel.
  3. The response should appear in the right hand panel. In the screenshot below, you should be able to see that there is one rulebase, “SimpleBenefits”, deployed to this Determinations Server along with the list of language(s) supported by that rulebase and the WSDL URLs for all services available for that rulebase.

 

Use soapUI to test a rulebase

You can use soapUI to test a rulebase deployed in the Determinations Server

To import the rulebase WSDL, do the following:

  1. Make sure that the Determinations Server is running
  2. Follow the steps in “Find out what rulebases are deployed on the Determinations Server” to get the Generic or Specific WSDLs for your deployed rulebase.
  3. In the left hand pane, right-click on the soapUI project and choose “Add WSDL”, enter the WSDL for the rulebase (for example, http://localhost:8080/det-server-102/assess/soap/generic/SimpleBenefits?wsdl). It is probably a good idea to turn off “Create sample requests for all operations”. In the figure below, you can see soapUI with the new rulebase WSDL on the left hand pane. There are two operations: Assess, and ListGoals.

 

Create and execute an Assess operation

Now that you have created the rulebase service you can test a simple request. It is a good idea to have the rulebase open in Oracle Policy Modeling so you can create attributes, entities and relationships with the correct name. You can see the attributes, entities and relationships that the rulebase uses by viewing the Build Model or the Data Model (View menu > Build Model/Data Model).

  1. In the left hand pane of soapUI, right-click on Assess operation and choose “New Request”. If asked to “Create optional elements in schema?” it is best to choose “No”.
  2. In the right hand pane, a request will be created with a blank assess request. You can now add entity instances, and their attributes and relationships and execute the request.
  3. Once you have the request you can right click on the right hand pane and choose “Validate”, which will validate your request against the rulebase WSDL. If everything is correct, soapUI will reply “Validation OK”, otherwise it will provide a list of errors.
  4. Execute the request by clicking the green arrow. The response should appear in the far right hand pane:
Example Generic Assess for SimpleBenefits Rulebase

Looking at the Data Model for the Simple Benefits rulebase (examples\rulebases\compiled\SimpleBenefits.zip in the Oracle Policy Automation Runtime package), we can see that the Global has some attributes and a relationship to the child entity.

For this example we will investigate the goal “eligible_low_income_allowance” and “eligible_teenage_allowance”.

 

 

Start the Assess request by adding the two attribute outcomes that we want to investigate in the global entity instance. In this case we will ask for value-only if the attribute is known and a full decision report if the value is unknown. The entire Assess request now looks like:

If we execute this request now, each attribute outcome will be unknown, with a decision report telling us which attributes require values in order to reach a determination for the given outcome.

From the decision report we can see that for the eligible_low_income_allowance attribute to have a value, we need to provide answers for the following attributes:

 

We can do that by adding the following to the global entity instance.

      <typ:attribute id="claimant_income">
               <typ:number-val>13000</typ:number-val>
            </typ:attribute>
            <typ:attribute id="claimant_public_housing_client">
               <typ:boolean-val>true</typ:boolean-val>
            </typ:attribute>
            <typ:attribute id="claimant_date_of_birth">
               <typ:date-val>1981-03-22</typ:date-val>
            </typ:attribute>

According to the decision report for the eligible_teenage_allowance goal, the relationship ‘claimantschildren’ needs to be known. As this is a containment relationship, this can be done by adding some instances of the ‘child’ entity to the global entity instance:

<typ:entity id="child">
    <typ:instance id="child_1">
        <typ:attribute id="child_age">
           <typ:number-val>9</typ:number-val>
        </typ:attribute>
    </typ:instance>
    <typ:instance id="child_2">
        <typ:attribute id="child_age">
            <typ:number-val>5</typ:number-val>
        </typ:attribute>
    </typ:instance>
</typ:entity>

Our Assess request should now look like the request below. Now the response (see below) provides the following answers for our goal:

eligible_teenage_allowance is false (the claimant is not eligible because neither of their children is between 13 and 19 years of age)

eligible_low_income_allowance is true (the claimant is eligible because they are a public housing client, they have an income below 20,000, and claimant date of birth is known).