Determinations Server Custom Service Example

This example demonstrates a custom service for Determinations Server and illustrates how it is possible to load reference data before calling the Assess method.

It deals with the scenario of a real-time inquiry for a claimant's medical outpatient benefits. When a claimant visits a clinic for a check-up, the system should be able to return all of the outpatient services for which the claimant is eligible and is currently entitled to.

To achieve this, we develop a custom service that meets the following requirements:

 

There are two basic actions that are exposed by the custom service:

  1. Return a list of available services for the claimant's card type.
  2. Check if the claimant is eligible and entitled to the requested outpatient service.

How to construct this example (Java)

The examples\custom-service directory in Oracle_Policy_Automation_Runtime_Java_10.2.1.zip file contains all of the files required to set up this example.

Option 1 – Deploy a fully working example

The examples\custom-service\webapp directory contains the determinations-server.war file. This is a fully set-up instance of Determinations Server, with the custom service already installed.

  1. Deploy this web application to Tomcat by copying the determinations-server.war file into the “webapps” directory of the Tomcat installation; for example, C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps.
  2. Test the service by following the instructions in the section below, Test the custom service.

Option 2 – Build an example from source files

Service code

The examples\custom-service\source\Java directory contains the Java source code for the service (the .NET source code is very similar). The service has the following two classes:

  1. OutpatientEligibilityService – this class implements the DSServicePlugin interface and contains the custom service logic
  2. CustomWsdl – this builds the WSDL for the custom service.

 

To build and deploy the service code, do the following:

  1. Build the Java files found in examples\custom-service\source\Java into a JAR file, using any Java development environment. You will need to tell your Java compiler how to find the required Oracle Policy Automation dependencies, as described in the Create a Plugin topic.
  2. Name the resulting JAR file, custom-service.jar
  3. Copy the custom-service.jar file you have created to the WEB-INF\classes\plugins directory of your determinations-server web application; for example, C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\determinations-server\WEB-INF\classes\plugins.
XML data file

The examples\custom-service\source\Java directory contains the XML data file health-insurance-data.xml which contains the reference data loaded by the Java code above.

It is suggested this file be placed in the determinations-server\WEB-INF\classes\plugins directory. Note that as the XML file location is not strictly mandated by Oracle Policy Automation, it can actually be placed anywhere on the file system, but if you do choose to locate the file in a path other than that recommended here, then that path will need to be specified in XML_FILE_PATH of the OutpatientEligibilityService.java file.

 

Copy the health-insurance-data.xml file from examples\custom-service\source\Java to determinations-server\WEB-INF\classes\plugins.

wsdl

The examples\custom-service\source\wsdl directory contains the WSDL templates that expose the custom service operations. Do the following:

  1. Create a new directory “custom” in determinations-server\ WEB-INF\classes\templates\wsdl
  2. Copy the files from examples\custom-service\source\wsdl to determinations-server\ WEB-INF\classes\templates\wsdl\custom
rulebase

The examples\custom-service\rulebase directory contains the rulebase which implements reasoning for outpatient eligibility. Do the following:

  1. Build the rulebase in Oracle Policy Modeling.
  2. Locate the built rulebase in output\OutpatientEligibility.zip.
  3. Copy the file OutpatientEligibility.zip file into determinations-server \WEB-INF\classes\rulebases

Test the custom service

To test that Determinations Server has been successfully installed, access the “determinations-server” web application from a browser; for example, http://localhost:8080/determinations-server. You should see the following links:

 

 

To examine the custom WSDL, click the last link labelled /determinations-server/custom/eligibility/OutpatientEligibility?wsdl.

To test the new custom service, you can use a tool such as SoapUI; sample SOAP requests and expected responses can be found in the examples\custom-service\sample-requests-responses.