cancel
Showing results for 
Search instead for 
Did you mean: 

An error occurred [Your InputStream was neither an OLE2 stream, nor an OOXML stream]

SOLVED
Occasional Contributor

An error occurred [Your InputStream was neither an OLE2 stream, nor an OOXML stream]

Hi,

 

Steps - 

1. Read response of API and write into XLSX file  - API response content type is ms-excel content disposition as app/filename

2.Read XLSX and coompare with expected xlsx file

 

While reading the XLSX which I cretaed in step 1 it is giving me error as below- 

 

ERROR:An error occurred [Your InputStream was neither an OLE2 stream, nor an OOXML stream], see error log for details

 

can someone help?

 

regards,

Manali

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: An error occurred [Your InputStream was neither an OLE2 stream, nor an OOXML stream]

Hi,

 

Reading response at run time resolved the issue. 

 

//read raw response at run time  
def rawResponse = context.httpResponse.getRawResponseBody();
InputStream inputStream = new ByteArrayInputStream(rawResponse);

// write Response to excel file
def file = new FileOutputStream(ActualExcelFilePath)
def out = new BufferedOutputStream(file)
int read = 0;
byte[] bytes = new byte[1024];
while ((read = inputStream.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
out.close();

3 REPLIES 3
Highlighted
Community Manager

Re: An error occurred [Your InputStream was neither an OLE2 stream, nor an OOXML stream]

Hi @mkajale2,

 

How do you save to response to an XLSX file? Groovy script? Please share it with us - I think it will help the Community understand the cause of the error.

 

BTW, I suppose that this request duplicates this one. Please avoid creating duplicated posts in the future.

https://community.smartbear.com/t5/SoapUI-Pro/how-to-write-api-response-into-xlsx-file-readyapi/m-p/...

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Community Manager

Re: An error occurred [Your InputStream was neither an OLE2 stream, nor an OOXML stream]

Hi @mkajale2,

 

Are you still looking for the solution? If you've found the one, please share it here.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Occasional Contributor

Re: An error occurred [Your InputStream was neither an OLE2 stream, nor an OOXML stream]

Hi,

 

Reading response at run time resolved the issue. 

 

//read raw response at run time  
def rawResponse = context.httpResponse.getRawResponseBody();
InputStream inputStream = new ByteArrayInputStream(rawResponse);

// write Response to excel file
def file = new FileOutputStream(ActualExcelFilePath)
def out = new BufferedOutputStream(file)
int read = 0;
byte[] bytes = new byte[1024];
while ((read = inputStream.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
out.close();

New Here?
Join us and watch the welcome video:
Top Kudoed Authors