I am using apache.cxf webClient .I am trying to upload file in the post API and I am trying to get the uploaded file path in the response. I am calling post method .
PostResponse response =webClient.post(attachments,PostResponse.class);
webClient.reset();
return response;
After getting the response I am returning the response to other method . In that method I am just reading some values in the response.
String path=response.getPath();
Everything works fine. When the file size is less than 10 kb, I am able to upload the file and I can read the path.
But when the size is around 500 kb , I am not able to upload the file . I am getting Exception "SocketException - Connection reset".
I changed the client settings to
webClient.connection.timeout.msecs=600000
webClient.receive.timeout.msecs=600000
webClient.connection.keepalive=true
But this also didnt help me much . I am suspecting the issue is with this line "webClient.reset();" . Is it so ? After reseting client , we are not supposed to read from the response ? But this code is working when the file size is less. If this is the problem then Shall I make code changes like
webClient.reset();
//Set the end points all others here
PostResponse response =webClient.post(attachments,PostResponse.class);
return response;
If you suspecting any other reason for the connection issue , please let me know. Thanks in advance .