0

I am new to Client side of microservice architecture. I am building a rest based client to submit mine form data using above piece of code.

public ResponseEntity<?> saveCustomerInfo(RegisterCustomer customerModel) {
    RestTemplate restTemp = new RestTemplate();

    String url= "http://localhost:8081/applicationDemo/saveCustInfo";

    HttpEntity http = new HttpEntity(customerModel);

    System.out.println(customerModel);
    ResponseEntity resp = 
    restTemp.postForEntity(url,http,ResponseEntity.class);

    System.out.println(resp.getBody());
    return null;

When i test above code using POSTMAN , it show exception as given below :

org.springframework.web.client.HttpClientErrorException: 415 null

I am not able to get what is gone wrong because when i hit micro services without client, it save the data.But when i use this Rest Template based method, it shows above exception.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
mohneesh
  • 1
  • 4
  • Refer https://stackoverflow.com/questions/4075991/post-request-via-resttemplate-in-json – Unknown Mar 30 '18 at 13:31
  • Possible duplicate of [POST request via RestTemplate in JSON](https://stackoverflow.com/questions/4075991/post-request-via-resttemplate-in-json) – eis Mar 30 '18 at 15:40

0 Answers0