We use connect-soap to read the stream. Stream coming from the external system (Filenet) is fine but the stream while writing to server location is getting corrupted. As i mentioned before the same logic works if the file size is < 1MB but it is corrupting if it is > 1MB. Also, we are not using any custom code for this function. We use 7.1.7 verison.
We found the issue and the cause is the file stream > 1MB requires multiple external calls to get the whole stream of pdf content (from filenet) instead of calling once but for <1MB files, we don't need to call the external service more than once hence it is working fine for < 1MB but for larger files the stream is not redenred completely in a single call and causing the generated file as corruputed file and there is no restriction on the connect-file.