...
Code Block | ||
---|---|---|
| ||
<medication>Cefuroxime</medication> <age>54</age> <creatinineLevel>1.2</creatinineLevel> |
Similarly, send another request:
Code Block | ||
---|---|---|
| ||
<medication>Amoxicillin</medication> <age>20</age> |
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 | ||
---|---|---|
| ||
package org.wso2.carbon.samples; import org.apache.axis2.AxisFault; import org.wso2.carbon.samples.healthCareService.patientDetail.Dose; import org.wso2.carbon.samples.healthCareService.patientDetail.Patient; import org.wso2.carbon.samples.healthCareService.patientDetail.PatientDetail; import org.wso2.carbon.samples.healthCareService.stub.HealthCareServiceStub; import java.rmi.RemoteException; public class HealthCareServiceTestCase { public static void main(String[] args) { try { HealthCareServiceStub healthCareServiceStub = new HealthCareServiceStub("http://localhost:9763/services/HealthCareService"); PatientDetail patientDetail = new PatientDetail(); Patient patient = new Patient(); patient.setAge(43); patient.setCreatinineLevel(1.0); patient.setMedication("Levofloxacin"); Patient[] patients = new Patient[1]; patients[0] = patient; patientDetail.setPatientDetail(patients); Dose[] doses = healthCareServiceStub.recommendDose(patients); String result = doses[0].getMessage(); System.out.println(result); } catch (AxisFault axisFault) { axisFault.printStackTrace(); } catch (RemoteException e) { e.printStackTrace(); } } |
Excerpt | ||
---|---|---|
| ||
HealthCare service sample of the WSO2 Business Rules Server samples guide. |