/**
* QQ在线状态查询
*/
public static void main(String[] args) {
//设置代理
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "192.168.0.26");
System.getProperties().put("proxyPort", "808");
//设置socket代码
System.getProperties().put("socksProxySet", "true");
System.getProperties().put("socksProxyHost", "192.168.0.26");
System.getProperties().put("socksProxyPort", "1080");
try {
//WebServices服务地址
String endpoint = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
//要调用的方法名
call.setOperationName("qqCheckOnline");
//设置调用方法参数
call.addParameter(new javax.xml.namespace.QName("http://WebXml.com.cn/",
"qqCode"), org.apache.axis.encoding.XMLType.XSD_STRING, String.class,
javax.xml.rpc.ParameterMode.IN);
//设置返回类型
call.setReturnClass(String.class);
/**
//new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema"
//, "string")或org.apache.axis.encoding.XMLType.XSD_STRING都可以
//设置返回类型
call.setReturnType(new javax.xml.namespace.QName(
"http://www.w3.org/2001/XMLSchema", "string"));
//返回参数名
call.setReturnQName(new javax.xml.namespace.QName(
"http://WebXml.com.cn/", "qqCheckOnlineResult"));
**/
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://WebXml.com.cn/qqCheckOnline");
//http://WebXml.com.cn/ 命名空间
call.setOperationName(new javax.xml.namespace.QName(
"http://WebXml.com.cn/", "qqCheckOnline"));
String k = (String) call.invoke(new Object[] { "285336157" });
System.out.println("result is " + k.toString() + ".");
} catch (Exception e) {
e.printStackTrace();
}
}
axis java 调用 .net Web Services
最新推荐文章于 2024-07-06 17:19:31 发布