| ILOG JRules User Guide > Integrating Application Data > Tasks > Using the XML Binding API > Using XML Objects as Ruleset Parameters |
Using XML Objects as Ruleset Parameters |
PREVIOUS NEXT |
Ruleset parameters enable you to exchange data between your ruleset and an external application. You will notice that there is no difference in the way XML objects and Java objects are handled.
To set an XML object as a ruleset parameter:
IlrContext, by setting the parameters before setting the rules. Use setParameterValue to identify the name of the ruleset parameter:
setParameters to set parameters by providing a map, thereby creating an association between the name and the value.
When using XML binding with Rule Execution Server, you can pass the parameters direct, as a String. The rule session API (ilog.rules.bres.session) provides an interface that converts your parameters from String to XML before passing them to the rule engine. Conversely, an output parameter is returned automatically as a String.
Use the following method to execute the rules in a stateful session:
IlrSessionExecutionResult executeRules(IlrSessionStatefulExecutionSettings executionSettings)
Use the following method to execute the rules in a stateless session:
IlrSessionResponse executeRules(IlrSessionRequest)
The session parameter setting would then be:
IlrSessionRequest sessionReq = ...;
IlrSessionExecutionSettings execSet = sessionReq.getExecutionSettings();
IlrSessionParameteres inputParams = execSet.getInputParameters();
inputParams.setParameter("xmlP", myXmlString);
Using this API you only need to pass the String. You do not need to deal with the XML driver. The rule session API provides access to the engine, and as a result conceals the IlrContext API.
Each parameter available in the rule session should have been declared in Rule Studio. For more information, see Creating Ruleset Parameters.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |