Skip to content

Instantly share code, notes, and snippets.

@arvind-pal
arvind-pal / RestController
Last active September 4, 2019 17:29
generic code to call SOAP service
@PostMapping(path="generic/rest")
public ResponseEntity<?> getBusinessValue(@RequestBody String soapRequest, @PathVariable("service") String service) throws ClientProtocolException, IOException {
HttpClient client = HttpClients.custom().build();
HttpEntity httpEntity = new StringEntity(soapRequest);
HttpPost postRequest = new HttpPost(service_path);
postRequest.setEntity(httpEntity);
HttpResponse httpResponse = client.execute(postRequest);
HttpEntity responseEntity = httpResponse.getEntity();