package com.ai.twr.webservice;
import com.ai.twr.xmlbean.updateHospitalDetailInfo.response.Response;
import com.ai.utils.XmlTransUtil;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import static org.jivesoftware.smackx.pubsub.FormType.result;
public class TwrClient {
public static void main(String[] args) {
try {
String endpoint = "http://localhost:8080/..../services/service?wsdl";
String endpoint = " ";
TwrClient client = new TwrClient();
client.updateHospitalDetailInfoTest(endpoint);
client.test();
}
catch (Exception e) {
System.err.println(e.toString());
}
}
private void updateHospitalDetailInfoTest(String endpoint ){
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperationName("queryResourceInfo");
call.addParameter("xml", org.apache.axis.encoding.XMLType.XSD_DATE,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://www.my.com/Rpc");
String temp = " <Request>\n" +
"\t<SystemId>1001</SystemId>\n" +
"\t<Password>123456</Password>\n" +
"\t<ApplyHospitalId>66</ApplyHospitalId>\n" +
"\t<AcceptHospitalId>666</AcceptHospitalId>\n" +
"</Request>";
String result = (String)call.invoke(new Object[]{temp});
com.ai.twr.xmlbean.queryResourceInfo.response.Response response = XmlTransUtil.getBeanFromXml(result,com.ai.twr.xmlbean.queryResourceInfo.response.Response.class);
System.out.println("result is "+result);
if (response!=null){
System.out.println("response.getResult_Code() is "+response.getResult_Code());
System.out.println("response.getMessage() is "+response.getError_Msg());
}
}
catch (Exception e) {
System.err.println(e.toString());
}
}
}