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
Prajakta_Kale
Occasional Visitor

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

I downloaded an attachment from an URL using groovy script . An attachment is in .xlsx format.
But while reading that .xlsx file it is throwing below error:

 

Your InputStream was neither an OLE2 stream, nor an OOXML stream] 

 

So I tried to read raw response as per suggestions using below snippet:

 

    def DownloadLink="https://bestbuyuat.service-now.com/api/now/attachment/4519d6eb1b592c90a531c8866e4bcb4d/file"
    def snowuserauth="Basic"
    def userCredentials2="${username}:${passwd}"
​    def httpConn =  new URL(DownloadLink).openConnection() as HttpURLConnection
    basicAuth1 = "${snowuserauth} " + new String(new sun.misc.BASE64Encoder().encode(userCredentials2.getBytes()));
    println("*** encoded1 "+basicAuth1);
    httpConn.setRequestProperty ("Authorization", basicAuth1);
    int BUFFER_SIZE = 4096;
    int responseCode1 = httpConn.getResponseCode();
    *def rawResponse = context.httpResponse.getRawResponseBody();
    InputStream inputStream = new ByteArrayInputStream(rawResponse);

 

But then it is giving me below error:

 

{returnCode=1, errorStream={returnCode=-1000, errorStream=Exeception while executing script: [{}]java.lang.NullPointerException: Cannot get property 'httpResponse' on null object}}

 

Please suggest on this.

1 ACCEPTED SOLUTION

Accepted Solutions
sonya_m
Community Manager

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

Hi @Prajakta_Kale ! Technical questions of this depth are out of my scope, but I did find a similar topic that has a solution - https://community.smartbear.com/t5/API-Functional-Security-Testing/An-error-occurred-Your-InputStrea...

 

Is that something you tried? Please let me know.


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

1 REPLY 1
sonya_m
Community Manager

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

Hi @Prajakta_Kale ! Technical questions of this depth are out of my scope, but I did find a similar topic that has a solution - https://community.smartbear.com/t5/API-Functional-Security-Testing/An-error-occurred-Your-InputStrea...

 

Is that something you tried? Please let me know.


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

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