I have a rest api at localhost:8086/addMessage and it works when I test it using POSTMAN. But when I want to integrate this api on client side it returns:
java.net.URISyntaxException: Expected scheme-specific part at index 10: localhost:
at java.net.URI$Parser.fail(URI.java:2848) ~[na:1.8.0_171] error:
This is my method that calls api:
public void addOrder(Message orders) throws Exception
{ RestTemplate restTemplate = new RestTemplate();
String resp = restTemplate.postForObject(
"localhost:8086/addMessage",
orders,
String.class);
}
How can I solve it.
Add 'http' scheme to your url,
http://localhost:8086/addMessage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With