Gippy Aulakh
Gippy Aulakh

Reputation: 102

SAP Cloud SDK (Java) throws naming error exception on SuccessFactors metadata load

I am not able to move forward due to an exception thrown by Cloud SDK. EdmNamedImpl class of cloud SDK is throwing an error due to incorrect SF Metadata property name. The property name of the SF entity is "goto-url", so due to hyphen in field name is not being accepted by PATTER_VALID_NAME matcher. I have tried many approaches but could not get around this exception. I guess Cloud SDK either should provide a way to suppress name validation or a way to pass path of local metadata file to execute method of FluentHelper.

The way I am constructing Query is:

new DefaultAPISuccessFactorsService().withServicePath("<host>/odata/v2").getAllUser().execute(PASSING_SF_DEST_HERE);

On execute, framework reads metadata from SF before executing actual query and fails on metadata read. Please see code snipped below where the exception is thrown from:

enter image description here

Here is the Maven Dependency Tree:

[INFO] +- com.sap.cds:cds-starter-spring-boot-odata:jar:1.3.0:compile
[INFO] |  +- com.sap.cds:cds-framework-spring-boot:jar:1.3.0:runtime
[INFO] |  |  +- com.sap.cds:cds-adapter-api:jar:1.3.0:runtime
[INFO] |  |  +- org.springframework:spring-context:jar:5.2.3.RELEASE:compile
[INFO] |  |  |  \- org.springframework:spring-expression:jar:5.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:5.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-tx:jar:5.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-jdbc:jar:5.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-web:jar:5.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-webmvc:jar:5.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.2.3.RELEASE:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-autoconfigure:jar:2.2.3.RELEASE:compile
[INFO] |  +- com.sap.cds:cds-adapter-odata-v4:jar:1.3.0:runtime
[INFO] |  |  +- com.sap.cds:cds4j-multitenant:jar:1.7.0:runtime
[INFO] |  |  \- com.sap.cds.repackaged:odata-v4-lib:jar:1.3.0:runtime
[INFO] |  |     +- javax.servlet:javax.servlet-api:jar:4.0.1:runtime
[INFO] |  |     +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.10.2:runtime
[INFO] |  |     |  +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.10.2:runtime
[INFO] |  |     |  |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:runtime
[INFO] |  |     |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.1:runtime
[INFO] |  |     |  +- org.codehaus.woodstox:stax2-api:jar:4.2:runtime
[INFO] |  |     |  \- com.fasterxml.woodstox:woodstox-core:jar:6.0.3:runtime
[INFO] |  |     \- com.fasterxml:aalto-xml:jar:1.2.1:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:2.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-json:jar:2.2.3.RELEASE:compile
[INFO] |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.2:compile
[INFO] |  |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.10.2:compile
[INFO] |  |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.10.2:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.2.3.RELEASE:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.30:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.30:compile
[INFO] |  |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.30:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-starter-validation:jar:2.2.3.RELEASE:compile
[INFO] |  |     +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |  |     \- org.hibernate.validator:hibernate-validator:jar:6.0.18.Final:compile
[INFO] |  |        +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] |  |        \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] |  \- org.springframework.boot:spring-boot-starter-jdbc:jar:2.2.3.RELEASE:compile
[INFO] |     \- com.zaxxer:HikariCP:jar:3.4.2:compile
[INFO] +- org.springframework.boot:spring-boot-starter-aop:jar:2.2.3.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.3.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  |  +- org.springframework:spring-core:jar:5.2.3.RELEASE:compile
[INFO] |  |  |  \- org.springframework:spring-jcl:jar:5.2.3.RELEASE:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.25:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.2.3.RELEASE:compile
[INFO] |  \- org.aspectj:aspectjweaver:jar:1.9.5:compile
[INFO] +- com.sap.cds:cds-feature-cloudfoundry:jar:1.3.0:compile
[INFO] |  +- com.sap.cds:cds-feature-api:jar:1.3.0:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.10.2:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] +- com.sap.cds:cds-services-api:jar:1.3.0:compile
[INFO] |  \- com.sap.cds:cds4j-api:jar:1.7.0:compile
[INFO] +- com.sap.cds:cds-services-impl:jar:1.3.0:runtime
[INFO] |  +- com.sap.cds:cds-services-utils:jar:1.3.0:runtime
[INFO] |  +- com.sap.cds:cds4j-runtime:jar:1.7.0:compile
[INFO] |  |  \- com.jayway.jsonpath:json-path:jar:2.4.0:compile
[INFO] |  |     \- net.minidev:json-smart:jar:2.3:compile
[INFO] |  |        \- net.minidev:accessors-smart:jar:1.2:compile
[INFO] |  |           \- org.ow2.asm:asm:jar:5.0.4:compile
[INFO] |  \- com.sap.cds:cds4j-tx:jar:1.7.0:runtime
[INFO] +- com.sap.cds:cds-feature-xsuaa:jar:1.3.0:compile
[INFO] +- com.sap.cloud.security.xsuaa:xsuaa-spring-boot-starter:jar:2.6.2:compile
[INFO] |  +- com.sap.cloud.security.xsuaa:spring-xsuaa:jar:2.6.2:compile
[INFO] |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
[INFO] |  |  +- com.sap.cloud.security.xsuaa:api:jar:2.6.2:compile
[INFO] |  |  +- com.sap.cloud.security.xsuaa:token-client:jar:2.6.2:compile
[INFO] |  |  +- com.github.ben-manes.caffeine:caffeine:jar:2.8.0:compile
[INFO] |  |  |  \- org.checkerframework:checker-qual:jar:2.10.0:compile
[INFO] |  |  \- commons-io:commons-io:jar:2.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-security:jar:2.2.3.RELEASE:compile
[INFO] |  |  +- org.springframework.security:spring-security-config:jar:5.2.1.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-web:jar:5.2.1.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-oauth2-jose:jar:5.2.1.RELEASE:compile
[INFO] |  |  +- com.nimbusds:nimbus-jose-jwt:jar:7.8:compile
[INFO] |  |  |  \- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] |  |  +- org.springframework.security:spring-security-core:jar:5.2.1.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-oauth2-core:jar:5.2.1.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-oauth2-resource-server:jar:5.2.1.RELEASE:compile
[INFO] +- com.sap.cds:cds-feature-hana:jar:1.3.0:compile
[INFO] |  \- com.sap.cloud.db.jdbc:ngdbc:jar:2.4.67:compile
[INFO] +- org.xerial:sqlite-jdbc:jar:3.28.0:compile
[INFO] +- com.sap.cloud.sdk.cloudplatform:scp-cf:jar:3.21.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:auditlog-scp-cf:jar:3.21.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.cloudplatform:auditlog:jar:3.21.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:caching:jar:3.21.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:security:jar:3.21.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.cloudplatform:tenant:jar:3.21.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core-scp-cf:jar:3.21.0:compile
[INFO] |  |  \- com.auth0:java-jwt:jar:3.10.3:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp-cf:jar:3.21.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity-scp:jar:3.21.0:compile
[INFO] |  |  +- com.sap.cloud.sdk.cloudplatform:resilience:jar:3.21.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.frameworks:resilience4j:jar:3.21.0:runtime
[INFO] |  |     +- io.github.resilience4j:resilience4j-circuitbreaker:jar:1.4.0:runtime
[INFO] |  |     |  \- io.github.resilience4j:resilience4j-core:jar:1.4.0:runtime
[INFO] |  |     +- io.github.resilience4j:resilience4j-bulkhead:jar:1.4.0:runtime
[INFO] |  |     +- io.github.resilience4j:resilience4j-timelimiter:jar:1.4.0:runtime
[INFO] |  |     +- io.github.resilience4j:resilience4j-cache:jar:1.4.0:runtime
[INFO] |  |     |  \- javax.cache:cache-api:jar:1.1.1:runtime
[INFO] |  |     \- io.github.resilience4j:resilience4j-retry:jar:1.4.0:runtime
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:security-scp-cf:jar:3.21.0:compile
[INFO] |  |  +- com.sap.cloud.security:java-security:jar:2.6.2:compile
[INFO] |  |  \- com.sap.cloud.security:java-api:jar:2.6.2:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:servlet:jar:3.21.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:tenant-scp-cf:jar:3.21.0:compile
[INFO] |  \- com.sap.cloud.sdk.cloudplatform:metering:jar:3.21.0:compile
[INFO] +- com.sap.cloud.sdk.datamodel:odata-core:jar:3.21.0:compile
[INFO] |  +- com.sap.cloud.sdk.datamodel:odata-client:jar:3.21.0:compile
[INFO] |  |  \- org.apache.commons:commons-lang3:jar:3.9:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-core:jar:3.21.0:compile
[INFO] |  +- com.sap.cloud.sdk.cloudplatform:cloudplatform-connectivity:jar:3.21.0:compile
[INFO] |  |  \- com.sap.cloud.sdk.quality:common:jar:3.21.0:compile
[INFO] |  |     \- org.apache.commons:commons-csv:jar:1.8:compile
[INFO] |  +- com.sap.cloud.sdk.datamodel:fluent-result:jar:3.21.0:compile
[INFO] |  +- com.sap.cloud.servicesdk:odatav2-connectivity-sdk3:jar:1.39.0:compile
[INFO] |  |  +- com.sap.cloud.servicesdk:jacksonutil-sdk3:jar:1.39.0:compile
[INFO] |  |  +- org.json:json:jar:20190722:compile
[INFO] |  |  \- com.sap.cloud.servicesdk.prov:api:jar:1.39.0:compile
[INFO] |  |     +- javax.transaction:javax.transaction-api:jar:1.3:compile
[INFO] |  |     \- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] |  |        \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  +- com.sap.cloud.servicesdk:odata-v2-lib:jar:1.39.0:compile
[INFO] |  |  \- com.sap.cloud.servicesdk:developer_license:jar:1.39.0:compile
[INFO] |  +- org.slf4j:jcl-over-slf4j:jar:1.7.30:runtime
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] |  +- com.google.guava:guava:jar:29.0-jre:compile
[INFO] |  |  +- com.google.guava:failureaccess:jar:1.0.1:compile
[INFO] |  |  +- com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
[INFO] |  |  \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] |  +- org.jsoup:jsoup:jar:1.13.1:compile
[INFO] |  +- org.apache.commons:commons-text:jar:1.8:compile
[INFO] |  +- com.google.code.gson:gson:jar:2.8.6:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.2:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.10.2:compile
[INFO] |  +- com.mikesamuel:json-sanitizer:jar:1.2.0:compile
[INFO] |  +- joda-time:joda-time:jar:2.10.5:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.10:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.13:compile
[INFO] |  +- io.vavr:vavr:jar:0.10.2:compile
[INFO] |  |  \- io.vavr:vavr-match:jar:0.10.2:compile
[INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
[INFO] |  \- com.sap.cloud.sdk.quality:odata-querylistener:jar:3.21.0:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.10:provided
[INFO] +- javax.inject:javax.inject:jar:1:provided
[INFO] +- org.modelmapper:modelmapper:jar:2.3.7:compile
[INFO] \- org.springframework.boot:spring-boot-starter-cache:jar:2.2.3.RELEASE:compile
[INFO]    \- org.springframework:spring-context-support:jar:5.2.3.RELEASE:compile
[INFO] ------------------------------------------------------------------------

Upvotes: 0

Views: 213

Answers (1)

MatKuhr
MatKuhr

Reputation: 563

Unfortunately I currently see no easy way around this. The SDK itself internally uses another library to perform OData 2.0 requests. The library performs the metadata request and processes it before issuing the actual request.

However, as shared in this answer a hyphen is not legal within entity identifiers. So this is more of a problem on the SuccessFactors side of things.

Edit:

There is a beta API in place that does not rely on metadata requests but requires you to assemble the request manually:

ODataRequestRead request =
            new ODataRequestRead("<host>/odata/v2", "Users", "", ODataProtocol.V2);
HttpClient client = HttpClientAccessor.getHttpClient(destination);

ODataRequestResult result = request.execute(client);
List<User> users = result.asList(User.class);

But that API is fully beta, requires manual effort and doesn't support some features. E.g. ETags are not being extracted from the response here. So I recommend using this only if you really need it working and can accept feature gaps and unstable API.

Upvotes: 1

Related Questions