("addUser");//WSDL里面描述的接口名称
("userName", ,
);//接口的参数
call..);//设置返回类型
String temp = "测试人员";
String result = (String)(new Object[]{temp});
//给方法传递参数,并且调用方法
("result is "+result);
}
catch (Exception e) {
(());
}
}
}
2,直接SOAP调用远程的webservice
这种模式我从来没有见过,也没有试过,但是网络上有人贴出来,我也转过来
..*;
..*;
..*;
import .*;
import .*;
import ;
public class caService{
public static String getService(String user) {
URL url = null;
try {
url=new URL(":8080/ca3/services/caSynrochnized");
} catch (MalformedURLException mue) {
return ();
}
// This is the main SOAP object
Call soapCall = new Call();
// Use SOAP encoding
();
// This is the remote object we're asking for the price
("urn:xmethods-caSynrochnized");
// This is the name of the method on the above object
("getUser");
// We need to send the ISBN number as an input parameter to the method
Vector soapParams = new Vector();
// name, type, value, encoding style
Parameter isb
Java调用WebService接口方法 来自淘豆网m.daumloan.com转载请标明出处.