外置接口请求
1. 請求接口
/*** 請求接口** @param url* @param paramsStr* @param type Connection.Method.POST* @param heads* @return*/ public JSONObject sendUpload(String url, String paramsStr, Connection.Method type, Map<String, String> heads) {//發(fā)送上傳訂單請求String erpUploadResponse = null;try {Connection connection = Jsoup.connect(url).ignoreContentType(true).header("Accept", "*/*").header("Content-Type", "application/json; charset=UTF-8").method(type).timeout(2000000);if (heads != null) {for (Map.Entry<String, String> entry : heads.entrySet()) {connection.header(entry.getKey(), entry.getValue());}}if (type == Connection.Method.POST) {connection.requestBody(paramsStr);}erpUploadResponse = connection.execute().body();} catch (IOException e) {logger.error("## FEITE面單上傳接口出錯!URL={},param={}, type={}", url, paramsStr, type);}return JSONObject.parseObject(erpUploadResponse); }2. 請求方式
JSONObject responseJson = sendUpload(erpQueryTraceId, JSON.toJSONString(param), Connection.Method.POST, null);?
轉(zhuǎn)載于:https://www.cnblogs.com/yifanSJ/p/10209887.html
總結(jié)
- 上一篇: 怀孕了梦到蛇是什么意思
- 下一篇: 梦到鞋踩到屎是什么征兆