Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are two ways to create a rule service using the WSO2 BRS management console as follows, which are:

...

1. Create a valid JAR containing the Java classes of facts and results defined for the Order Approval sample use user case in Sample Rule Definition.

...

3. Create a rule service configuration using the instructions in File-Based Configuration. The configuration file used for the sample is shown below, which is named as service.rsl (Rule Service Language) and which is used for the sample is shown below.

 

Code Block
languagehtml/xml
titleservice.rsl
<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>

 

...

7. The Upload Rule Service window opens. Upload the file created in step 4 and click Upload. For example, Upload as shown below.

8. The Deployed Services window opens with the newly uploaded business rules exposed as a service. Click on it to access its dashboard and select the TryIt option on the Client Operations panel in the service dashboard.

...

A rules service can be created through the rule service wizard of the WSO2 BRS management console, as follow.follows:

1. Log in to the WSO2 BRS management console and click Create under Rules Service in the Main page.

...

2. The Service Information window opens. Enter the required information and click Next. The service name has to be unique. For example, 

3. The Rule Set Information window appears. There are four ways to specify a rule set or a rule script.

...

4. Once the rule is uploaded click Next. The Facts Upload window appears to upload facts and results that are used in the rule script. It should be a valid jar file and multiple . Multiple jar files can be uploaded. For example, create a jar file from the facts and results defined in Sample Rule Definition.

...

6. The Add Operation window appears. Fill in the fields appropriately. For example, 

  • Name: Operation name which is mandatory.
  • Input and output facts: You can use fact "selector" to select a type, which you have already uploaded in the input fact upload step. In this example, one fact is added with the type as samples.userguide.PlaceOrder and two outputs with types as samples.userguide.OrderReject and samples.userguide.OrderAccept. Note that Type is the only mandatory attribute in both input and output facts.

...