Skip to Content
0
Former Member
May 19, 2020 at 01:01 PM

SAP Cloud Platform Android app can't upload media

193 Views Last edit May 19, 2020 at 03:05 PM 3 rev

Just a quick followup: I am 100% sure the file I try to upload is existing and I can access it. I proved this by creating a copy of it just before processing.

------------------------

Hi,

I'm developing an Android app and I'm using the CV_ATTACHMENT_SRV OData service. The problem is that I cannot upload media to this service.

I created a ByteStream by using the method,

ByteStream content = ByteStream.fromInput(inputStream);

I tried to use the

createMedia(EntityValue entity, StreamBase content, HttpHeaders headers)

method of the service to upload an image where the entity is basically an instance of 'OriginalContent', the content is the ByteStream created earlier, and the headers contain some additional information related OriginalContent.

This is what I get:

com.sap.cloud.mobile.odata.DataStreamException: stream is closed  

at com.sap.cloud.mobile.odata.http.OKByteStreamBody.writeTo(OKByteStreamBody.java:46)  

at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:59)  

at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)  

...

I tried to figure out if I have access to the file I want to upload so I tried the above mentioned method with having a file on the external storage and packaged in the project. None of them worked.

Did you guys meet this kind of situation? I'm having a hard time finding similar situations. Please help.