/**
* java 调用 .net web services 第二种方式
*/
public static void main(String[] args) {
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "192.168.0.26");
System.getProperties().put("proxyPort", "808");
System.getProperties().put("socksProxySet", "true");
System.getProperties().put("socksProxyHost", "192.168.0.26");
System.getProperties().put("socksProxyPort", "1080");
try {
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));
//设置执行的方法、参数、返回值
org.apache.axis.description.OperationDesc oper;
org.apache.axis.description.ParameterDesc param;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("qqCheckOnline");
param = new org.apache.axis.description.ParameterDesc(
new javax.xml.namespace.QName("http://WebXml.com.cn/", "qqCode"),
org.apache.axis.description.ParameterDesc.IN,
new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
"string"), java.lang.String.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName(
"http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName(
"http://WebXml.com.cn/", "qqCheckOnlineResult"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
call.setOperation(oper);
/**
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.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
call.setReturnClass(String.class);
call.setReturnQName(new javax.xml.namespace.QName("http://WebXml.com.cn/", "qqCheckOnlineResult"));
**/
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://WebXml.com.cn/qqCheckOnline");
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();
}
}