I am working on JAXWS webservice which creates a SOAP request and response. There are cases the response which I get from a JAXWS is pretty heavy with a huge payload and it is taking lot of time to get the response where I am getting SocketTimeoutException quite regularly. Is there any possibility where we can improve the performance of the JAXWS by sending a payload data (response) in small chunks in an iterative manner rather than sending all of them at once? More over we are using the JAXB unmarshaller to parse the SOAP response that also takes lot of time? Could you please suggest how to resolve thgese problems? Whether REST WS helps in this scenario or is there any other alternative steps we can take it to make sure everything functions properly? Please clarify.
You shouldn't get a socket timeout when there is lots of data, the data transfer represents activity. Are you sure it isn't the result of an unstable connection or some odd server setting which closes connections after being open for X minutes? If that is the case I would try to solve that, an unstable runtime environment is nearly impossible to support through clever coding. Imagine switching to a chunking strategy, you'd run into the problem where for example of 3 chunks only one of them fails so you are left with partially complete data only. The problem becomes more difficult to manage, not easier.