/**
* 检查QQ是否在线
*/
@Test
public void qqCheckOnline(){
String endpoint = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl";
Service service = new Service();
try {
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setSOAPActionURI("http://WebXml.com.cn/qqCheckOnline");
call.setOperationName(new QName("http://WebXml.com.cn/", "qqCheckOnline"));
call.addParameter(new QName("http://WebXml.com.cn/", "qqCode"),
org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.SOAP_STRING);
System.out.println(call.invoke(new Object[]{"160468630*"}));
}catch (Exception e) {
e.printStackTrace();
}
}
/**
* 获取天气
*/
@Test
public void getWeather(){
String endpoint = "http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl";
Service service = new Service();
try {
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new URL(endpoint));
call.setSOAPActionURI("http://WebXml.com.cn/getWeather");
call.setOperationName(new QName("http://WebXml.com.cn/", "getWeather"));
call.addParameter(new QName("http://WebXml.com.cn/", "theCityCode"),
org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter(new QName("http://WebXml.com.cn/", "theUserID"),
org.apache.axis.encoding.XMLType.XSD_STRING, ParameterMode.IN);
call.setReturnType(XMLType.SOAP_VECTOR);
System.out.println(call.invoke(new Object[]{"",""}));
}catch (Exception e) {
e.printStackTrace();
}
}