cancel
Showing results for 
Search instead for 
Did you mean: 

Error during oData API_CV_ATTACHMENT_SRV in SAP Integration Suite

Simon
Participant
0 Kudos

Hello SAP Experts,

i have a problem that I could use some advice on.

I want to create an attachment on the delivery document using API_CV_ATTACHMENT_SRV/AttachmentContentSet.

Via Postman, this works fine with the following header parameters:

Simon_0-1712062048611.png

As body i use "Binary" where i upload my pdf-File.

But when i try to build the same call in SAP Cloud Integration via an iFlow i get the following error:

"Error Details
com.sap.gateway.core.ip.component.odata.exception.OsciException: Request Payload Parsing Failed for one of the reason: (1) Either the OData metadata content available in the server is outdated OR (2) The request payload seems to be incorrect. Error Details : only whitespace content allowed before start tag and not J (position: START_DOCUMENT seen J... @1:1) , org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not J (position: START_DOCUMENT seen J... @1:1)"

Simon_1-1712062140147.png

As body i use a pdf File which i get as a response from another webservice with Content-Type "application/pdf".

Any hints ? Do i have to convert the file before calling the oData Service.

Tried to use the BASE64 Encode Function, but getting the same error.

Thanks in Advance.

Simon

Accepted Solutions (0)

Answers (1)

Answers (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @Simon,

OData adapter in Cloud Integration has to be setup as XML document. If you send as payload a JSON string, it will cause that error.

https://me.sap.com/notes/0003074490

Please see the note statements here:

https://help.sap.com/docs/integration-suite/sap-integration-suite/configure-odata-v2-receiver-adapte...

 It is also valid for OData v4.

The note states that you must treat all payload in an iflow as XML and once it gets sent out to a backend server that requires JSON string as payload it will be converted internally by the adapter. 

Best regards,
Ivan 

Simon
Participant
0 Kudos
Hi Ivan, thanks for you support. I read the notes already, but didnt find a solution for my problem. I dont send json nor xml unfortunately. The WebService expects no body expect the file for the attachment. I have also switched to a HTTP Receiver, but getting the same error 😞 Any idea ?
Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @Simon,

Try using a json2xml converter at the start of the iflow - if your sender's adapter is marked as OData as well.

Maybe the OData API doesn't require you to send any JSON payload at all, but from the iFlow perspective data should be assigned to the data model defined on an EDMX. 

Also, import the data model via EDMX file you downloaded from API Business Accelerator Hub. Then perform any mappings necessary in the payload.

https://help.sap.com/docs/cloud-integration/sap-cloud-integration/importing-from-odata

Read more on OData integration here:

https://help.sap.com/docs/SAP_COMMERCE/50c996852b32456c96d3161a95544cdb/73bb18f0ccfc4b4c9222106814e2...

There is a nice blog using EDMX to consume OData service here:

https://community.sap.com/t5/technology-blogs-by-members/sap-cloud-platform-integration-cpi-part-8-w...

Best regards,
Ivan

Simon
Participant

Hi @Ivan-Mirisola , i was able to solve the problem. I deleted to oData Adapter and switched to HTTP again. Now it works 🙂

Thanks for you support.