java調用netwebservice--soap:
try {
String url = "http://192.168.12.106/yhcapp/MesServerMng.asmx?wsdl";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(url));
//WSDL裡面描述的接口名稱,參數說明為:QName("xml裡面的命名空間","方法名");
call.setOperationName(new QName("http://www.hustcad.com/InteCAPP/XMLWEBServices/","Mes_ProjectInfo"));
//ProjectNo 為Mes_ProjectInfo 方法裡的參數,有多個的話復制一行即可,注意後面的類型--XSD_STRING
call.addParameter(newQName("http://www.hustcad.com/InteCAPP/XMLWEBServices/","ProjectNo"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的參數
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//設置返回類型
call.setSOAPActionURI("http://www.hustcad.com/InteCAPP/XMLWEBServices/Mes_ProjectInfo"); //這個必須加,不加報錯
String ProjectNo = "要傳入的數據"
String result = (String)call.invoke(new Object[]{ProjectNo}); //多個變量逗號隔開即可
System.out.println("返回結果為:"+result);
} catch (Exception e) {
System.out.println(e.getMessage());
}