springboot调xml数据
applocation.properties 配置 EVNANA_METHOD_URL = http://192.168.111.230:8080/YJServices/getEvnAnaData
Controller
// MVC视图模板后缀路径 @Value("${EVNANA_METHOD_URL}") private String evnAnaMethodUrl;
HttpClient evnAnaClient = new HttpClient();
HttpMethod evnAnaMethod = new UTF8PostMethod(evnAnaMethodUrl);
((PostMethod) evnAnaMethod).setParameter("width", request.getParameter("width"));
((PostMethod) evnAnaMethod).setParameter("density", request.getParameter("density"));
evnAnaClient.executeMethod(evnAnaMethod);// 执行请求
String retXmlStr = evnAnaMethod.getResponseBodyAsString();// 返回结果
// 解析返回xml
Document document = DocumentHelper.parseText(retXmlStr);
Element rootNode = document.getRootElement();
// System.out.println(rootNode.getName());
// 遍历近距离点位--------------------------------------------------
Map<String, Object> lowMap = new HashMap<String, Object>();
Element lowEle = rootNode.element("low");