日期:2014-05-18 浏览次数:20649 次
public static void main(String[] args) {
String url="http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx";
String soapPre="http://WebXml.com.cn/";
try{
Service service=new Service();
Call call=(Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(url));
call.setOperationName(new QName(soapPre,"getCountryCityByIp"));
call.addParameter(new QName(soapPre,"theIpAddress"), org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(new QName(soapPre,"getCountryCityByIp"),Vector.class);
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapPre + "getCountryCityByIp");
Vector<String> v=(Vector<String>)call.invoke(new Object[]{"1.202.90.134"});
System.out.println("***************");
for(int i=0;i<v.size();i++)
{
System.out.println(v.get(i));
}
&