Versions Compared

Key

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

...

 

Code Block
languagehtml/xml
<loanType>FHA</loanType>
<mortgageValue>100000</mortgageValue>
<downPayment>90000</downPayment>
Similarly, another request can be sent:

 

Code Block
languagehtml/xml
<loanType>PMI</loanType>
<mortgageValue>100000</mortgageValue>
<downPayment>90000</downPayment>

 

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

 

Code Block
languagejava
package org.wso2.carbon.samples;

import org.apache.axis2.AxisFault;
import org.wso2.carbon.samples.mipCalculateService.clientDetail.Client;
import org.wso2.carbon.samples.mipCalculateService.clientDetail.MIP;
import org.wso2.carbon.samples.mipCalculateService.clientDetail.PlaceClientDetail;
import org.wso2.carbon.samples.mipCalculateService.stub.MIPCalculateServiceStub;
import java.rmi.RemoteException;

public class MIPCalculateServiceTestCase {

    public static void main(String[] args) {

        try {
            MIPCalculateServiceStub mipCalculateServiceStub =
                    new MIPCalculateServiceStub("http://localhost:9763/services/MIPCalculateService");
            PlaceClientDetail placeClientDetail = new PlaceClientDetail();

            Client client = new Client();
            client.setLoanType("FHA");
            client.setDownPayment(8000);
            client.setMortgageValue(90000);
            Client[] clients = new Client[1];
            clients[0] = client;

            MIP[] mips = mipCalculateServiceStub.calculate(clients);
            double result = mips[0].getAnnualMIP();
            System.out.println(result);

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

Mortgage insurance premium calculation service sample of the WSO2 Business Rules Server samples guide.