cancel
Showing results for 
Search instead for 
Did you mean: 

Error while calling C4C Odata service either via HTTP or OData from CPI

0 Kudos
1,353

Hi Experts,

While calling an OData service in C4C from CPI, we are having issues. it is a simple iflow where we are receiving JSon payload using HTTP and we want to post it to C4C. we tried calling Odata service using odata and HTTP both. C4C service itself is working as we can see from postman, so issue is while calling from CPI.

While using HTTP method to call the OData service, we are getting bad request error.

If we use Odata, we get below error.

"com.sap.it.rt.adapter.http.api.exception.HttpResponseException: An internal server error occured: 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 { (position: START_DOCUMENT seen {... @1:1) , org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not { (position: START_DOCUMENT seen {... @1:1)"
Found this answer where Eng says that we cant use JSON with Odata adapter but i am not sure how to go about using xml for a c4c web-service.

https://answers.sap.com/questions/12697667/creating-leadcollection-via-odata-in-sap-c4c-using.html

Any Help is appreciated.

Thanks,

Hemant

View Entire Topic
PrasanthRao
Product and Topic Expert
Product and Topic Expert

Hi Hemant,

OData adapter in CPI expects a plain XML as input. You can check the details on payload structure in the following blog post.

https://blogs.sap.com/2017/09/06/payload-structures-in-odata-v2-adapter-for-sap-cloud-platform-integ...

The adapter also provides wizard that can help you generate the necessary XSD scheme. Refer the following blog.

https://blogs.sap.com/2018/04/10/sap-cloud-platform-integration-odata-v2-query-wizard/

So if your incoming request is a Json payload, you can use a JSON to XML converter followed by Message Mapping to create the necessary payload.

Best regards,

Prasanth