We are using Spring 4
WebServiceTemplate
to contact a WCF
web service. One of the items we send across to this web service are images (JPEG format). For some of the cases when the image is slightly bigger (about 22KB), we get the following error:
<pre><code>org.springframework.ws.client.WebServiceIOException: I/O error: Connection reset; nested exception is java.net.SocketException: Connection reset</pre></code>
If we do not send the image at all, this error does not happen. So it clearly seems to be related to the payload size because with smaller-sized images or with no images there is no issue. This 22KB is approximately twice the size as the image size during other invocations.
We have tried switching from SaajSoapMessageFactory
to AxiomSoapMessageFactory
as suggested here, but the result is same.
class <className> extends WebServiceGatewaySupport {
<className>() {
super(new AxiomSoapMessageFactory());
AxiomSoapMessageFactory messageFactory =
(AxiomSoapMessageFactory) getMessageFactory();
messageFactory.setPayloadCaching(false);
...
}
...
}
Does anyone how to fix this?