axis2 client 调用webservice例子

 String url = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx";  
         Service service = new Service();  
         Call call = (Call) service.createCall();  
         call.setTargetEndpointAddress(new java.net.URL(url));  
         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,
                    javax.xml.rpc.ParameterMode.IN);
         call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
         call.setUseSOAPAction( true );
         call.setSOAPActionURI( "http://WebXml.com.cn/qqCheckOnline" );
         String result = (String) call.invoke( new Object[]{"18129478"});
         System.out.println(result);

你可能感兴趣的:(webservice)