![](http://static.oschina.net/uploads/space/2014/0422/104441_G1EM_1473586.png)
![](https://i-blog.csdnimg.cn/blog_migrate/6a40327940e293213414e543ad9bc029.jpeg)
![](https://i-blog.csdnimg.cn/blog_migrate/77c7ed53e00185ca6c9c455c3f8f3e16.jpeg)
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();
}*/
}
}