import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
/**
* 获得腾讯QQ在线状态(doc from http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?op=qqCheckOnline)
* 输入参数:QQ号码 String,默认QQ号码:8698053。
* 返回数据:String,Y = 在线;N = 离线;E = QQ号码错误;A = 商业用户验证失败;V = 免费用户超过数量
* @author zuoguodang
*
*/
public class GetQQStatus {
public GetQQStatus(){
}
public static void main(String[] args) throws Exception {
String endpoint = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl";
Service service = new Service();
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[]{"418182328"}));
}
}
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
/**
* 获得腾讯QQ在线状态(doc from http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?op=qqCheckOnline)
* 输入参数:QQ号码 String,默认QQ号码:8698053。
* 返回数据:String,Y = 在线;N = 离线;E = QQ号码错误;A = 商业用户验证失败;V = 免费用户超过数量
* @author zuoguodang
*
*/
public class GetQQStatus {
public GetQQStatus(){
}
public static void main(String[] args) throws Exception {
String endpoint = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl";
Service service = new Service();
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[]{"418182328"}));
}
}
本文介绍了一个简单的Java程序,用于查询指定QQ号码的在线状态。通过调用WebXML提供的Web服务接口,程序能够获取并打印出目标QQ账号的当前在线状态。
1047

被折叠的 条评论
为什么被折叠?



