iMES请求SAP添加请求头认证

This commit is contained in:
彭枝刚 2024-12-05 09:47:18 +08:00
parent 3f5d450db0
commit 35a2e16a25

View File

@ -26,12 +26,22 @@ public class SapUtil {
private static final String sapUser = "RFC";
private static final String sapPassword = "Admin@1234567890";
private static final JSONObject headJson;
static {
headJson = new JSONObject();
headJson.put("x-esb-apikey","hWS3L96a0h4NKCAjN9hG1OmOeEIsxCTz");
headJson.put("x-esb-env","DEV");
}
public static String appendHead(String jsonStr) {
JSONObject allJson = new JSONObject();
allJson.put("API_METHOD", "POST");
JSONObject json = JSONObject.parseObject(jsonStr);
allJson.put("API_DATA", json);
allJson.put("API_PATH", sapUrl);
allJson.put("headers", headJson);
return allJson.toJSONString();
}
@ -40,6 +50,7 @@ public class SapUtil {
allJson.put("API_METHOD", "POST");
allJson.put("API_DATA", jsonObj);
allJson.put("API_PATH", sapUrl);
allJson.put("headers", headJson);
return allJson;
}