In Springs we have RestTemplate class. from this class we call the rest services.Below are the sample code for Get and Post requests.
@Autowired
RestTemplate restTemplate;
Calling a Get method:
Map<String, String> domainCategories = restTemplate.getForObject("http://test.com?reportId=100" Map.class);
Calling a Post Method:
TriageFirstCutResponse response = restTemplate.postForObject(
"rest URL", triageFirstCutRequest,TriageFirstCutResponse.class);
here triageFirstCutRequest is an object.which is the post parameter.
@Autowired
RestTemplate restTemplate;
Calling a Get method:
Map<String, String> domainCategories = restTemplate.getForObject("http://test.com?reportId=100" Map.class);
Calling a Post Method:
TriageFirstCutResponse response = restTemplate.postForObject(
"rest URL", triageFirstCutRequest,TriageFirstCutResponse.class);
here triageFirstCutRequest is an object.which is the post parameter.