| Samples > Rule Execution Server Integration > How to Generate a Monitored Transparent Decision Service |
How to Generate a Monitored Transparent Decision Service |
PREVIOUS NEXT |
This sample shows how to use the Rule Studio Web service generation wizard, deploy the transparent decision service, and invoke it.
To invoke a ruleset on the Rule Execution Server, you must write execution code to communicate with the application server and locate the deployed RuleApp that contains the ruleset. This code is best written in Rule Studio inside a client project. Rule Studio provides several project generators to assist with this task. Among them, you will find the Web service code generator. The Web service is implemented with the aid of the Sun Microsystems JAXWS 2.0 reference implementation.
The Web service interface is generated using the ruleset parameters, as shown in the following diagram. This interface contains one method for each ruleset of the RuleApp to run.
Keys features include:
To install the sample you need to import it, generate the Transparent Decision Service, deploy it, then update the client project.
Before importing the sample:
JAVA_HOME environment variable to the folder where the Java 5 SDK is installed.
To import the sample:
samples > architecture > webdecisionservice.
The imported sample project files are displayed in the Rule Explorer:
pretradechecks-xom : The Java execution model
pretradechecks-wds-rules : The rule project
pretradechecks-wds-ruleapp : The RuleApp project
To generate the Transparent Decision Service:
pretradechecks-wds, then click Next.
pretradechecks-wds-ruleapp, then click Next.
pretradechecks-wds-rules, then click Next.
/shared/tools/jboss. The deployment directory is filled automatically.
bres in the Login and Password field.
Connection Successful message.
JBoss for pretradechecks-wds.esc and click OK. The RES configuration is set.
You now need to deploy the Transparent Decision Service.
To deploy the Transparent Decision Service:
pretradechecks-wds.
pretradechecks-wds is selected.
pretradechecks-wds project. We will fix the errors in the pretradechecks-wds-client project later.
pretradechecks-wds project, click on the build.xml file.
WAR file is created containing your transparent decision service, and is deployed to your JBoss deployment directory:
pretradechecks-wds build.xml.
To update the Client Project:
pretradechecks-wds-client project and click on the build.xml file.
generate-client target is selected in the list, then click Run.
pretradechecks-wds-client project and click Refresh to reload the workspace with the new generated files.
pretradechecks-wds-client project, open the file src/pretradecheckswdsruleapp/PretradecheckswdsRunnerClient.java in the Java editor. Click in the editor and press CTRL+SHIFT+F to reformat the generated Java source code.
pretradechecks-wds-client build.xml configuration.
The sample can only be run through the Samples Console.
At this stage, the transparent decision service has been created, compiled and deployed. The client side application has been created and compiled, and is now ready to run.
To run the client side application:
pretradechecks-wds-client build.xml configuration.
When the Web application is initialized, the transparent decision service is registered in the Rule Execution Server. When the transparent decision service is executed, performance metrics are sent to the Rule Execution Server Console, which you can go and view.
To view the performance metrics:
The source files used in the sample are automatically generated by the wizard. This wizard generates two Java projects, one that implements the transparent decision service, and one that implements a simple client application to call the service.
The following files are generated:
build.xml: An Ant build file that automates the deployment steps.
build.properties: Used to parameterize the build.xml file.
logging.properties: a logging file that describes specific configuration information for handlers.
pretradecheckswdsruleapp.jar: RuleApp archive file from the source RuleApp project.
ra.xml: the Execution Unit (XU) configuration file.
.java and .xml files that implement a transparent decision service.
The transparent decision services use the following Java classes:
PretradecheckswdsRunner.java: Defines the interface for the transparent decision service. This interface contains one method for each ruleset of the RuleApp to run
PretradecheckswdsRunnerImplService.java: Implements the transparent decision service
PretradecheckswdsrulesRequest.java: Class that wraps the in and inout ruleset parameters
PretradecheckswdsrulesResult.java: Class that wraps the inout and out parameters and data related to the ruleset execution
RulesetExecutionException.java: General Exception class used in the transparent decision service
ExecutionHook.java: Hook allowing you to access the request and result before and after execution
PretradecheckswdsrulesListener.java: A utility class that registers/unregisters the transparent decision service in the Rule Execution Server Console. The performance metrics for the transparent decision service execution are sent to Rule Execution Server using an MBean and can be viewed within the Rule Execution Server Console
The component named PretradecheckswdsRunner is implemented as a Web service. This Web service is implemented with the aid of the Sun Microsystems JAXWS 2.0 reference implementation. Therefore, the serialization mechanism used assumes that Web service parameters respect the JavaBean specification.
The following files are generated:
build.xml: An Ant build file that automates the deployment steps.
build.properties: Used to parameterize the build.xml file.
.java and .xml files that implement a transparent decision service client.
The transparent decision service client uses PretradecheckswdsRunnerClient.java. This is a client class that calls the transparent decision service.
To be able to run the client, the transparent decision service must be correctly installed on Tomcat. The client is not "ready-to-run". PretradecheckswdsRunnerClient.java needs to be updated in order to add the IN parameters. You also need to run the provided generate-client Ant task that generates proxy client classes.
We used the Web service wizard to generate two Java projects, one that implements a transparent decision service, and one that implements a simple client application to call this service.
The transparent decision service can be deployed on a JBoss 4.0.5 (or Tomcat 6.0) server using the Ant build.xml file provided.
The client side application contains just one simple class. Client artifact classes can be generated in the build/src directory using the provided Ant build.xml file.
The overall runtime feature is shown in the following diagram:
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |