How to increase download speed using the following method?
Forcing System.gc() isn't a good practice.
outputStream = new FileOutputStream(pdfFile);
        bufferedOutputStream = new BufferedOutputStream(outputStream);


should be wrapped into 1 variable to do a single close() afterwards:

outputStream = new BufferedOutputStream(new FileOutputStream(pdfFile));

All operations with outputStream should be put in try-finally block:

outputStream = new ...
try {
    outputStream.write(...);
    ...
} finally {
    outputStream.close();
}

Agree with the first comment: your file may simply not fit in memory. In SOAP API there should be some mean of getting the InputStream instead of an in-memory string.


Sorry for the formatting, couldn't fight the editor.

Good luck!