Versions Compared

Key

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

...

Deploying and Testing the Service

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 Exposing Rules as Services.

2. After deployment, the service will appear in the Deployed Services window of the BRS management console. Access the service's dashboard by clicking on it.

3. In the Client Operations widget of the dashboard, invoke the Try-it toolTesting WSDLs (Try-it Tool) to  to test the service.

4. In the service's Try-it window, issue a request similar to the following.

 

Code Block
languagehtml/xml
<type>idd</type> 
<period>12</period>

Similarly send another request:

Code Block
languagehtml/xml
<type>local</type>
<period>12</period>

5. Alternatively, you can use code generation 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 option "Unpacks the databinding classes".

 

Code Block
languagejava
package test.com.Client;

    import org.apache.axis2.AxisFault;
    import test.com.callcharge.CallCharge;
    import test.com.callcharge.CallChargeE;
    import test.com.callcharge.CallLog;
    import test.com.callcharging.CallChargingServiceStub;

    import java.rmi.RemoteException;

    public class CallChargingTestCase {
        public static void main(String[] args) {
            try {
                CallChargingServiceStub callChargingServiceStub = new CallChargingServiceStub("http://localhost:9763/services/CallChargingService");

                CallChargeE callChargeRequest = new CallChargeE();
                CallLog callLog = new CallLog();
                callLog.setPeriod(200);
                callLog.setType("local");
                CallLog[] callLogs = new CallLog[1];
                callLogs[0] = callLog;

                callChargeRequest.setCallLog(callLogs);

                CallCharge[] callCharges = callChargingServiceStub.charge(callLogs);
                if(callCharges != null){
                    for (CallCharge callCharge : callCharges){
                        System.out.println("Tha charge for the call : " + callCharge.getAmount());

                    }
                }
            } catch (AxisFault axisFault) {
                axisFault.printStackTrace();
            } catch (RemoteException e) {
                e.printStackTrace();
            }

        }
    }
Excerpt
hiddentrue

Call charging service sample of the WSO2 Business Rules Server samples guide.