Hosted transparent decision services

To access Rule Execution Server through a web service, you can create an execution component that is linked to a ruleset path, called a hosted transparent decision service.

A hosted transparent decision service is an execution component that is linked to a ruleset path through a JMX management bean (MBean). Using such a transparent decision service, you can make rulesets available as web services without any code deployment.

To use a hosted transparent decision service, you proceed in two steps:
  1. Install Rule Execution Server on your application server.
  2. Deploy the hosted transparent decision services archive to the same server.
The product distribution provides enterprise archive (EAR) files for each supported application server in the following directory: <InstallDir>/ODM/executionserver/applicationservers/<app-server>/jrules-res-htds-<app_server>.ear.
Note: For the Tomcat application server, a web archive (WAR) file is provided.

The following figure shows the Operational Decision Manager architecture for a hosted transparent decision service:

Architecture for a hosted transparent decision service
Any hosted transparent decision service provides the following information:
  • The declaration of the transparent decision service
  • The ruleset path that it uses
  • Whether the service uses interceptors
  • Whether the service executes rulesets synchronously or asynchronously
  • Transparent decision service statistics: number of successful calls, number of calls with faults, average processing time, last processing time, initialization date and time
  • Metadata: service author, service version, service name, service description, server name and IP address, version number of Decision Server execution components

You can package the metadata that presents a ruleset as a hosted transparent decision service (XML schema files) within the ruleset archive. The transparent decision service uses the ruleset parameters to execute the web service.

Through a hosted transparent decision service, Rule Execution Server automatically presents as a web service any deployed rulesets that use an XML schema or a Java™ XOM. The transparent decision service automatically generates a Web Services Description Language (WSDL) file for each deployed ruleset archive. The transparent decision service MBean can retrieve execution statistics.

Interceptors

You can specify that the service uses interceptors by setting the InterceptorEnabled parameter to true in the web.xml file.

<context-param>
   <param-name>InterceptorEnabled</param-name>
   <param-value>true</param-value>
</context-param>

Asynchronous execution of transparent decision services

By default, transparent decision services are parsed synchronously to force execution of the most up-to-date version of a ruleset. To execute an old ruleset until the parsing of the new ruleset is finished, set the AsynchronousRulesetParsing parameter in the web.xml of the transparent decision service to true.

<context-param>
   <param-name>AsynchronousRulesetParsing</param-name>
   <param-value>true</param-value>
</context-param>

XML schema

The XML binding mechanism uses the WSDL and schema files to build new XOM types. The schema files must be associated with a package name. The new XOM types are defined under the provided package. The list of schema files in the dynamic XOM path makes up the root XML schema files from which a complete list is computed. That list includes the dependencies. Root schemas are also included in their own schema dependencies. You can use Rule Designer to control whether this dependency is included in the ruleset archive.

Java XOM

For a Java XOM model, the schemas are by default in the namespace that is given by the configuration of the hosted transparent decision service, with the default JAXB generation.
If you have no setXXX and getXXX methods, the internal parameter XXX is not part of the generated WSDL. You can change this behavior by adding JAXB annotations. For example, suppose that you have the following class:
public class MyLoan{
private double requestAmount;
public MyLoan(double requestAmount)
{
  this.requestAmount = requestAmount;
}
public double getRequestAmount() {
return requestAmount;
}
}

If this class is the only input parameter of the ruleset, the default generated WSDL contains only the following lines:

<xs:schema targetNamespace="http://www.ibm.com/rules/decisionservice/MyRuleApp/MyRuleset">

  <xs:complexType name="myLoan">
    <xs:sequence/>
  </xs:complexType>
  
</xs:schema> 

However, if you add the following JAXB annotations:

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name="my-loan", namespace="http://www.acme.com/loan")
public class MyLoan {

  @XmlElement(name="requestAmount")
private double requestAmount;

public MyLoan(double requestAmount) {
  this.requestAmount = requestAmount;
  }

public double getRequestAmount() {
return requestAmount;
}
}

And if this class is the input parameter of the ruleset again, the generated WSDL contains the following lines:

<xs:schema targetNamespace="http://www.acme.com/loan">

  <xs:complexType name="my-loan">
    <xs:sequence>
      <xs:element name="requestAmount" type="xs:double"/>
    </xs:sequence>
  </xs:complexType>
  
</xs:schema>

XML binding for Java types

Hosted transparent decision services support the first-level elements of the simple Java types, and the corresponding XML binding parameters in the WSDL code. A simple Java type is the finest-grain type from which a complex Java type can be expressed. A mapping table is provided in XML serialization of Java types.

WSDL generation

A WSDL file is a file that describes a web service. See the W3C web page Web Services Description Language . The format of a WSDL file is independent of the language that generates it. You can use WSDL files to generate client code. For more information about the available clients, see the page Invoking web services with Java clients.

The WSDL file that is generated by the transparent decision service references the XML schema types that are packaged in the RuleApp. You can use a tool such as Web Tools Platform (WTP) to generate a web service Java client. For more information, see the page Web Tools Platform (WTP) Project.

You can configure the WSDL generation through the Rule Execution Server console. You can configure the location and the web service endpoint. For more information, see Setting HTDS options.

WSDL generation configuration

Before you view or download the WSDL code for a hosted transparent decision service, you can configure the WSDL generation. Here are the available options:

  1. Define target namespaces in the HTDS WSDL options of a ruleset. See Changing target namespaces.
  2. Configure the web service endpoint. See Configuring the web service endpoint.
  3. If you deployed the HTDS archive to a different server than localhost, you can change the location of the archive for that ruleset. See Configuring the transparent decision service location.
  4. If you intend to import the transparent decision service into an IBM® Integration Designer project or to a different computer, download the WSDL file with the appropriate compatibility and zip parameters. See Setting HTDS options.

The following diagram illustrates this workflow.

HTDS WSDL generation workflow

Web service URLs and options

After the ruleset is deployed to the console, use a client to execute the web service. To access the WSDL file in the application, use this URL:
http://<server>:<port>/DecisionService/ws/<rulesetName>[/<rulesetVersion>]/<ruleAppName>[/ruleAppVersion>]?WSDL[&[&<options>]]*
Any of the following WSDL URLs is valid for a ruleset with the canonical path /myruleapp/1.0/myruleset/1.0:
  • http://localhost:<PORT>/DecisionService/ws/myruleapp/1.0/myruleset/1.0?WSDL
  • http://localhost:<PORT>/DecisionService/ws/myruleapp/1.0/myruleset?WSDL
  • http://localhost:<PORT>/DecisionService/ws/myruleapp/myruleset/1.0?WSDL
  • http://localhost:<PORT>/DecisionService/ws/myruleapp/myruleset?WSDL
The following parameters are available for [&<options>]:
  • zip=[true|false]: If you set this option to true, the generation process creates separate files for each inline type and compresses them into a single archive.
  • compatibility=[70|71|7113]: If you set this option to one of the version values, the generated WSDL is compatible with that version of client applications.
  • download=[true|false]: If you set this option to true, your web browser is enabled to force the download of the .zip or .wsdl files.
  • trace=[true|false]: If you set this option to true, the generated WSDL code includes decision trace information.

Your request returns status codes to the calling client. For more information, see HTTP status codes and XML serialization.

Monitoring of transparent decision services

The Rule Execution Server console provides a view of the RuleApps that are activated by a transparent decision service. From the Rule Execution Server console, you can take one of the following actions:
  • Select a ruleset within a RuleApp and open the associated WSDL file.
  • Change the endpoint URL used to access the WSDL file.
  • Obtain statistics on the ruleset that was executed through the transparent decision service. JMX MBeans can also read these statistics.