When the return was a error, the inputstream need to be the Error Input Stream. Implemented a catch where try first the normal stream, if has a error use the error stream.