This documentation is for WSO2 Business Rules Server 2.0.0.View documentation for the latest release.

Versions Compared


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




5. Log in to the WSO2 BRS management console and select "Rule Service -> Upload" in the "Main" menu.

6. The "Upload Rule Service" window opens. Upload the file created in step 4 and click "Upload". For example,

7. 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.

8. The Try-It tool can be used to test the sample through a request similar to the one shown bellow.


Code Block
<symbol>Company A</symbol>


9. Each rule can be tested by changing values in the symbol, price and quantity. For the request given above, the response will be as follows.


Code Block
         <brs:OrderAccept xsi:type="ax2277:OrderAccept">
                <ax2275:message>Accepted order for: 223 stocks of IBM at$ 14.0</ax2275:message>


10. Also, the WSDL of the service can be used to generate client-side code (stub) required for the service invocation. There is an option for code generation in the services management page. A client using generated stub codes is shown below and the codes are generated with option - "Unpacks the databinding classes".

Code Block
package org.wso2.carbon.samples;
import org.wso2.carbon.samples.orderApprovalService.order.OrderAccept;
import org.wso2.carbon.samples.orderApprovalService.order.PlaceOrder;
import org.wso2.carbon.samples.orderApprovalService.order.PlaceOrderE;
import org.wso2.carbon.samples.orderApprovalService.order.PlaceOrderRespone;
import org.wso2.carbon.samples.orderApprovalService.stub.OrderApprovalServiceCallbackHandler;
import org.wso2.carbon.samples.orderApprovalService.stub.OrderApprovalServiceStub;
import java.rmi.RemoteException;

public class PlaceOrderTestCase {

    public static void main(String[] args) {

        try {
            OrderApprovalServiceStub orderApprovalServiceStub = new OrderApprovalServiceStub("http://localhost:9763/services/OrderApprovalService");
            PlaceOrderE placeOrderE = new PlaceOrderE();
            PlaceOrder placeOrder = new PlaceOrder();
            PlaceOrder[] placeOrders = new PlaceOrder[1];
            placeOrders[0] = placeOrder;

            PlaceOrderRespone placeOrderRespone = null; //new PlaceOrderRespone();
            try {
                placeOrderRespone = orderApprovalServiceStub.placeOrder(placeOrders);
            } catch (RemoteException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            OrderAccept[] orderAccepts = placeOrderRespone.getOrderAccept();
            String result = orderAccepts[0].getMessage();

        } catch (Exception e) {

Rule Service Wizard

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

1. Log in to the WSO2 BRS management console and select "Rule Service -> UploadCreate" in the "Main" menu.

Image RemovedImage Added

62. The "Upload Rule Service Information" window opens. Upload the file created in step 4 Enter the required information and click "UploadNext". The service name has to be unique. For example,


 Image Added

3. The "Rule Set Information" window appears.

Image Added

There are four ways to specify a rule set or a rule script.

  • In-lined : Script is provided in the window itself

Image Added

  • Registry Key: Include the rule script in the system's governance registry. (Multiple scripts can be added here).

Image Added

  • Rule File: Upload a Drools rules file from a folder.

Image Added

  • URL: Upload from a url

Image Added