Hi Guys,
This is my experience to thank you, My Software AG Designer 10.3 on pub.client:http I can’t pass body on Method delete ,This is a known scenario and Integration Server doesn’t accept request body for HTTP DELETE Method.
i use Java Service like this so HTTP method DELETE can use payload json
- The first i imported the httpclient jar.
- the second i use java source code :
String resultJson = null;
String rescode = null;
String jsonInputString = jsonBodyString;
try {
url = new URL (uri);
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Content-Type", "application/json; utf-8");
con.setRequestProperty("Accept", "application/json");
con.setDoOutput(true);
try(OutputStream os = con.getOutputStream()){
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
int code = con.getResponseCode();
rescode = String.valueOf(code);
try(BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"))){
StringBuilder response = new StringBuilder();
String responseLine = null;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
resultJson = response.toString();
}
} catch (Exception e) {
e.printStackTrace();
}
thanks for tutorials/PostJSONWithHttpURLConnection.java at master · eugenp/tutorials · GitHub
did anyone solve it this way…
sorry if there is a mistake
Thanks & Regards
Maman H