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);

posted @ 2012-09-01 21:56  mark_xue  阅读(3722)  评论(0编辑  收藏  举报