import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.types.Schema;
public class Test {
public static void main(String[] args) {
try {
String endpoint = "http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl";//
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://WebXml.com.cn/", "getSupportCityString")); //方法名称
call.addParameter(new QName("http://WebXml.com.cn/", "theRegionCode"),
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);//参数
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_SCHEMA);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://WebXml.com.cn/getSupportCityString");//
Schema result = (Schema) call.invoke(new Object[] { "北京" });
for (int i = 0; i < result.get_any().length; i++) {
System.out.println(result.get_any()[i]);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
一搜一大片的东西 但不知道为什么大多都没法运行。。。参照文档做了修改 至少是可运行了