【发布时间】:2022-12-01 19:09:32
【问题描述】:
I want to hit a PUT API and pass XML as body of the API in JAVA. Can someone please tell me how to do it.
For passing JSON as Body of the API in JAVA I use
obj = parser.parse(new FileReader("file Path"));
jsonObject = (JSONObject) obj;
String jsonString = jsonObject.toJSONString();
Map<String, String> body = new ObjectMapper().readValue(jsonString, HashMap.class);
response = RestAssuredExtension.PostOpsWithBody(url, body);
I know how to call the PUT API but not how to pass the xml as body
【问题讨论】: