cancel
Showing results for 
Search instead for 
Did you mean: 

Create Attachments Android SDK 7.0.0

prashanthgurram
Explorer
0 Kudos

Hi Everyone,

We are using SDK 7.0.0, calling CreateMedia method in the dataService class to attach as stream which is internally calling the AttachmentContentSet entity of the backend API. The attachment is getting created in the backend however, the SDK is calling the API twice, its creates the attachment first time and is throws an error "Method 'ATTACHMENTCONTEN_GET_ENTITY' not implemented in data provider class".

The SDK is performing a second HTTP "POST" instead of a "GET". As per note 3324935 I can confirm the $value is also being sent.

AttachmentContentSet(DocumentInfoRecordDocType='GOS',DocumentInfoRecordDocNumber='EXT48000000000074',DocumentInfoRecordDocVersion='00',DocumentInfoRecordDocPart='000',LogicalDocument='000C29A5CF231EDE96F349C59E028988',ArchiveDocumentID='000C29A5CF231EDE96F349C59E02A988',LinkedSAPObjectKey='4500000118',BusinessObjectTypeName='BUS2012')/$value

Regards,

Prashanth

Accepted Solutions (1)

Accepted Solutions (1)

evanireland
Advisor
Advisor
0 Kudos

The usual steps taken by createMedia are:

(1) POST the media content.

(2) If no content is returned in the response (e.g. it returns 204 No Content), we send a GET request to get the value(s) of any non-media properties that the server might have generated. (If the server doesn't return payload for the initial POST and won't respond to that subsequent GET request, that makes it rather difficult to get any non-media generated properties back to the client, so I would encourage you to ask the server team to address that).

(3) Per OData Version 4.01. Part 1: Protocol (oasis-open.org), "It is not possible to set the structural properties of the media entity when creating the media entity." So we subsequently send a PATCH (OData 4+) or MERGE (OData 3-) to set any non-media properties that the client might have wanted to set along with the media content. Since MERGE (for OData V3-) isn't a standard HTTP verb, in that case we send this request as a POST with header X-HTTP-Method containing the MERGE verb.

To disable step 2 see https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/reference/android/java...

To disable step 3 see https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/reference/android/java...

Bear in mind that steps 2 and 3 have a well-defined purpose and if the backend doesn't support them I would encourage you to contact the team that built that server and ask them to make improvements.

But meanwhile the above-mentioned ServiceOptions settings should suffice to avoid the issues that you described.

prashanthgurram
Explorer
0 Kudos

Thanks Evan, the issue is resolved now.

Answers (1)

Answers (1)

prashanthgurram
Explorer
0 Kudos

Thanks Evan, will check and let you know the outcome.

jenny_slay
Participant
0 Kudos

Hi Prashanth,

We are facing very similar issue, any idea what action you have taken to resolve this issue ?

We have tried adding different value such as 0, 204 and 205 in setLoadIfCreateStatus(int), still we are getting the error.

Appreciate any suggestion on this. thankyou

BR, Jenni