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

Versions Compared


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


  1. Deploy the rule service through the BRS management console. You can follow either of the two methods:

    • Bundle all artifacts in an .aar file and upload it (Rule Service -> Upload menu).
    • Create using the Rule Service wizard UI (Rule Service -> Create menu).

    The above steps are discussed in detail in section  Exposing Rules as Services.
  2. After deployment, click on List under Services in the main tab of the management console. The service will appear in the Deployed Services page.
  3. Click OrderApproval to access the dashboard of the service.
  4. Click Try this service in the Client Operations widget of the dashboard to invoke the Try-it tool.
  5. Issue a request similar to the following in the Try-it tool.

    Code Block

    You would get the following response:

    Code Block
          <reason>An Order for stocks of IBM is accepted only if the number of stocks is higher than 10.</reason>
  6. Enter another request as follows:

    Code Block

    You would get the following response

    Code Block
          <message>Accepted order for: 100 stocks of SUN at$ 120.0</message>
  7. Enter another request as follows:

    Code Block

    You would get the following result: 

    Code Block
          <reason>An Order for stocks of MSFT is accepted only if the stock price is higher than 50 $ and the number of stocks is lower than 200.</reason>
  8. Alternatively, you can use Generate Axis2 Client link in the  Client Operations widget of the dashboard to invoke the service. A client using generated stub codes is shown below where the codes were generated with the Unpacks the data binding classes check box checked. 

    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.setSymbol("Company A");
                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) {