As you probably read in my other post, OPA is a great alternative to the Oracle Business Rules (OBR) as all the business logic could be exposed via web services. Unfortunately Oracle didn’t leave us much documentation about how to do that. So if you’re wondering how do you call OPA determinations server, here is an example:
If you open the determinations server URL on your weblogic server (something like http://yourserver:7001/determinations-server) you will see whole bunch of interfaces exposed for each ruleset:
- interface for listing all available interfaces
- version-specific interfaces
- non-version specific version of the interface, which is actually a link to the most recent version
Version-specific interfaces are divided into generic and specific interfaces. Specific interface provides all the attribute names in the interface. Generic is more flexible, you specify your parameters as a list of keyvals. This example is the non-version-specific generic interface call:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://oracle.com/determinations/server/10.4/rulebase/assess/types">
<soapenv:Header/>
<soapenv:Body>
<typ:assess-request>
<typ:config>
<typ:show-silent>true</typ:show-silent>
<typ:show-invisible>true</typ:show-invisible>
<typ:show-properties>true</typ:show-properties>
<typ:show-events>true</typ:show-events>
<typ:resolve-indecision-relationships>true</typ:resolve-indecision-relationships>
</typ:config>
<typ:global-instance>
<typ:entity id="household">
<typ:instance id="1">
<typ:attribute id="INPUT" outcome-style="value-only">
<typ:text-val>input_value</typ:text-val>
</typ:attribute>
<typ:attribute id="RESULT" inferred="true" outcome-style="value-only" />
</typ:instance>
</typ:entity>
</typ:global-instance>
</typ:assess-request>
</soapenv:Body>
</soapenv:Envelope>