cancel
Showing results for 
Search instead for 
Did you mean: 

SAP BTP IOS - Unrecoverable CSDL parsing failure!​

Sasikirank
Explorer
0 Kudos

Hello,

My project has included below destination and i need to work on it but the internal metadata parser class fails to convert the xml to csdl document.

static func parse() -> CSDLDocument {

let parser = CSDLParser()

parser.logWarnings = false

parser.csdlOptions = CdsApiHandlingUnitEntitiesMetadataParser.options

parser.csdlFetcher = CdsApiHandlingUnitEntitiesMetadataParser.fetcher

let metadata = parser.parseInProxy(CdsApiHandlingUnitEntitiesMetadataText.xml, url: "cds_api_handling_unit") // crashing

metadata.proxyVersion = "21.7.2"

return metadata

}metadata.txt

Below is the error.

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

Fatal error: 'try!' expression unexpectedly raised an error: UnexpectedException; Caused by: AssertException: Unrecoverable CSDL parsing failure!

Accepted Solutions (0)

Answers (3)

Answers (3)

evanireland
Advisor
Advisor
0 Kudos

The original metadata has an Edmx:Reference that looks like this:

    <edmx:Reference Uri="https://my300942-api.s4hana.ondemand.com/sap/opu/odata/iwfnd/catalogservice;v=2/Vocabularies(TechnicalName='%2FIWBEP%2FVOC_CAPABILITIES',Version='0001',SAP__Origin='LOCAL')/$value" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
        <edmx:Include Namespace="Org.OData.Capabilities.V1" Alias="Capabilities"/>
        <edmx:Include Namespace="Org.OData.Capabilities.V1"/>
    </edmx:Reference>

If you can get the server team responsible to remove the duplicate edmx:Include I think the error may go away.

Best to open an incident so that the Assistant can be fixed to report any such errors at proxy generation time rather than at run time.

evanireland
Advisor
Advisor
0 Kudos

Maybe you can use the "Insert File" button (looks like paper clip) to insert the complete contents of the CdsApiHandlingUnitEntitiesMetadataText.swift here.

Sasikirank
Explorer
0 Kudos

Thanks Evan for guiding.I have updated the question and attached the metadata file.Please check once

evanireland
Advisor
Advisor
0 Kudos

It would be expected for the xml string to start with a "<" character, rather than " \n".

Perhaps if we could see the original metadata document it would help.

Were the proxies generated by the Assistant or by the sapcpsdk-proxygenerator?

Sasikirank
Explorer
0 Kudos

Proxy classes were generated by Assistant.Out of 10 other destinations only this one is creating issue and making the app crashes.

I dont know why the string was changed after pasting here.

Actual Metadata string is starting correctly

"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<?xmlc base=\"36\"?>\n<?xmlc-define _0=\"Name\" _1=\"Type\" _2=\"Property\" _3=\"sap:label\" _4=\"MaxLength\" _5=\"sap:quickinfo\" _6=\"sap:display-format\" _7=\"edmx:Reference\" _8=\"Precision\" _9=\"Scale\" _A=\"Namespace\" _B=\"edmx:Include\" _C=\"sap:unit\" _D=\"xmlns:edmx\" _E=\"Alias\" _F=\"Role\" _G=\"Uri\" _<_2 _0=\"StorageType\" _1=\"$0\" _4=\"$8\" _6=\"$2\" _3=\"Storage Type\"/><_2 _0=\"StorageSection\" _1=\"$0\" _4=\"$8\" _6=\"$2\" _3=\"Storage Section\"/><_2 _0=\"StorageBin\" _1=\"$0\" _4=\"$M\" _6=\"$2\" _3=\"Storage Bin\"/><_13 _0=\"to_HandlingUnitItem\" ................