public static void main(String[] args) {
try {
CalculateServiceServiceLocator service = new CalculateServiceServiceLocator();
java.net.URL url = new java.net.URL("http://localhost:8080/WebServiceTest/services/CalculateService?wsdl");
/* java.net.URL url = new java.net.URL("http://localhost:8080/WebServiceTest/services/CalculateService");*/
CalculateServiceSoapBindingStub cssbs = new CalculateServiceSoapBindingStub(url, service);
float f =cssbs.divide(5, 3);
System.out.println("相除:"+f);
f =cssbs.plus(3, 6);
System.out.println("相加:"+f);
} catch (RemoteException e) {
// TODO Auto-generated catch block20
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/* 静态引用Webservice
* CalculateServiceProxy csp = new CalculateServiceProxy();
CalculateService cs = csp.getCalculateService();
try {
float f=csp.multiply(3, 3);
System.out.println("乘积:"+f);
f=cs.divide(5, 2);
System.out.println("相除:"+f);
} catch (RemoteException e) {
e.printStackTrace();
}*/
}
}