i'm trying to set a timeout on a webservicetemplate and it works only if it is under 21 seconds, if i try to set the timeout over 21 seconds it won't work it will timeout everytime when it reaches 21 seconds.I've tried lots of configs and mostly all of them are doing the same thing.
@Bean
public WebServiceTemplate munisService() {
WebServiceTemplate template = new WebServiceTemplate();
template.setMarshaller(service1Marshaller());
template.setUnmarshaller(service1Marshaller());
template.setDefaultUri(ancomUrl);
HttpComponentsMessageSender httpComponentsMessageSender = new HttpComponentsMessageSender();
httpComponentsMessageSender.setReadTimeout(180000);
httpComponentsMessageSender.setConnectionTimeout(180000);
template.setMessageSender(httpComponentsMessageSender);
return template;
}
@Bean
ServiceImpl ServiceBean(Jaxb2Marshaller marshaller) {
ServiceImpl service= new ServiceImpl ();
service.setWebServiceTemplate(munisService());
service.setDefaultUri(ancomUrl);
service.setMarshaller(marshaller);
service.setUnmarshaller(marshaller);
return service;
}
Does anyone know why is this happening? If it helps this is the exception and i'm using httpclient 4.5.13
org.springframework.ws.client.WebServiceIOException: I/O error: Connection timed out: connect; nested exception is java.net.ConnectException: Connection timed out: connect
Also the request is done on localhost, i'm running a spring boot app on localhost which does some requests.