文件名称:apache-cxf
文件大小:50.12MB
文件格式:ZIP
更新时间:2020-12-05 08:47:30
apache-cxf
apache-cxf 调用远程服务接口 public static String getNoCompressStr(String methodName, String params) { WebClient client = WebClient.create(NET_CLIENT + methodName); HTTPConduit conduit = (HTTPConduit) WebClient.getConfig(client).getConduit(); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnectionTimeout(1000 * 60 * 3000); httpClientPolicy.setAllowChunking(false); httpClientPolicy.setMaxRetransmits(100000); httpClientPolicy.setReceiveTimeout(1000 * 60 * 3000); conduit.setClient(httpClientPolicy); String retStr = null; try { retStr = client.accept("application/x-www-form-urlencoded").type("application/x-www-form-urlencoded") .post(params, String.class); } catch (ClientException e) { } catch (IllegalStateException e) { } if(UtilValidator.isEmpty(retStr)){ return null; } SAXReader read = new SAXReader(); Document doc = null; try { doc = read.read(new ByteArrayInputStream(retStr.getBytes("UTF-8"))); } catch (UnsupportedEncodingException | DocumentException e) { } catch (ClientException e) { } if(null == doc){ return null; } Element root = doc.getRootElement(); if(UtilValidator.isEmpty(root)){ return null; } return root.getText(); }