...
- Windows, Linux or Solaris operating system should exist.
- WSO2 BRS should be installed. To install the BRS, refer Installing the Product. This also includes installing Apache Ant as one of the Installation Prerequisites.
- WSO2 BRS should be started as described in Running the Product.
Sample
...
configuration
Table of Contents maxLevel 4 minLevel 4
Sample
...
rule definition
Rules
Rule 1 : An order for stocks of Company IBM is accepted only if the number of stocks is higher than 10.
Rule 2 : An order for stocks of Company SUN is accepted only if the stock price is higher than 100 $.
Rule 3 : An order for stocks of Company MSFT is accepted only if the stock price is higher than 50 $ and the number of stocks is lower than 200.
...
There is one fact named Order. OrderAccept
and OrderReject
are used to capture the result of the service.
Rule
...
service configuration (service.rsl)
Code Block | ||||
---|---|---|---|---|
| ||||
<ruleService name="OrderApprovalService" xmlns="http://wso2.org/carbon/rules" targetNamespace="http://com.test/orderApproval"> <ruleSet> <rule resourceType="regular" sourceType="file">orderApprovalRules.drl</rule> </ruleSet> <operation name="placeOrder"> <input wrapperElementName="placeOrder" namespace="http://com.test/placeorder"> <fact elementName="order" namespace="http://com.test/placeorder" type="samples.userguide.PlaceOrder"></fact> </input> <output wrapperElementName="placeOrderRespone" namespace="http://com.test/placeorder"> <fact elementName="orderAccept" namespace="http://com.test/placeorder" type="samples.userguide.OrderAccept"></fact> <fact elementName="orderReject" namespace="http://com.test/placeorder" type="samples.userguide.OrderReject"></fact> </output> </operation> </ruleService> |
Executing the
...
service
To execute the sampleservice, run the ant
command from the <PRODUCT_HOME>/samples/quotation.service
directory to run the OrderApproval Service.
Info |
---|
Before executing this sampleservice, it is recommended that you refer Exposing Rules as Services Exposing Rules as Services which explains in detail the process of writing and deploying a business rule. |
...