Symptom
When fetching an OData call, the OData Explorer is showing the error below:
In the context of Data Services an unknown internal server error occured|Error while parsing an XML stream: 'character data expected'.
Environment
SAP Cloud for Customer
Reproducing the Issue
Issue can be raised in any objects/collections, take an example of query of Lead Collection:
When fetching the URL: https://<mytenant>/sap/c4c/odata/v1/c4codataapi/LeadCollection, error raised.
Cause
There is an issue in error parsing in XML format. Error is related to invalid data present with the response payload.
Resolution
You need to fix the invalid data in the response payload. In order to find the invalid data, kindly use the skip and top filters to find the erroneous data. You can also refer the KBA to use different methods and filters in OData Service.
Take an example: Using https://<mytenant>/sap/c4c/odata/v1/c4codataapi/LeadCollection?$top=1000 check if the first 1000 records included the invalid data, then using https://<mytenant>/sap/c4c/odata/v1/c4codataapi/LeadCollection?$skip=1000&$top=1000 checking the next 1000 records, and continue.
You can refer to KBA 2330688 and use other methods to located the invalid data based on your business.
See Also
Keywords
Error, OData, Parsing, XML, stream, Character, Data, Expected, In the context of Data Services an unknown internal server error occurred , KBA , LOD-CRM-INT-API , OData API (C4C Only) , Problem
SAP Knowledge Base Article - Public