I am using Java VDM Generator to generate service classes with SAP Cloud SDK archetype project and the version is 3.7.0.
The OData service I used is API_SALES_ORDER_SIMULATION_SRV. I downloaded the metadata from SAP API Business Hub. Actually I also tested the metadata on S/4HANA on-premise 1909. The issue still exists.
The plugin I used to in pom.xml is as below:
<plugin>
<groupId>com.sap.cloud.sdk.datamodel</groupId>
<artifactId>odata-generator-maven-plugin</artifactId>
<version>3.7.0</version>
<executions>
<execution>
<id>generate-consumption</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputDirectory>${project.basedir}/edmx</inputDirectory>
<outputDirectory>${project.build.directory}/vdm</outputDirectory>
<deleteOutputDirectory>true</deleteOutputDirectory>
<defaultBasePath>/sap/opu/odata/sap/</defaultBasePath>
<packageName>com.bosch.testvdm</packageName>
<serviceNameMappingFile>${project.basedir}/serviceNameMappings.properties</serviceNameMappingFile>
<compileScope>COMPILE</compileScope>
</configuration>
</execution>
</executions>
</plugin>
The service interface/class generated are APISALESORDERSIMULATIONSRVService and DefaultAPISALESORDERSIMULATIONSRVService. Some methods are lost in the service. E.g. createSalesOrderSimulationAPI().
/*
* Generated by OData VDM code generator of SAP Cloud SDK in version 3.7.0
*/
package com.bosch.testvdm.services;
import javax.annotation.Nonnull;
import com.bosch.testvdm.namespaces.salesordersimulationsrv.batch.APISALESORDERSIMULATIONSRVServiceBatch;
import com.sap.cloud.sdk.datamodel.odata.helper.batch.BatchService;
/**
* <h3>Details:</h3><table summary='Details'><tr><td align='right'>OData Service:</td><td>API_SALES_ORDER_SIMULATION_SRV</td></tr></table>
*
*/
public interface APISALESORDERSIMULATIONSRVService
extends BatchService<APISALESORDERSIMULATIONSRVServiceBatch>
{
/**
* If no other path was provided via the {@link #withServicePath(String)} method, this is the default service path used to access the endpoint.
*
*/
String DEFAULT_SERVICE_PATH = "/sap/opu/odata/sap/API_SALES_ORDER_SIMULATION_SRV";
/**
* Overrides the default service path and returns a new service instance with the specified service path. Also adjusts the respective entity URLs.
*
* @param servicePath
* Service path that will override the default.
* @return
* A new service instance with the specified service path.
*/
@Nonnull
APISALESORDERSIMULATIONSRVService withServicePath(
@Nonnull
final String servicePath);
}
/*
* Generated by OData VDM code generator of SAP Cloud SDK in version 3.7.0
*/
package com.bosch.testvdm.services;
import javax.annotation.Nonnull;
import javax.inject.Named;
import com.bosch.testvdm.namespaces.salesordersimulationsrv.batch.DefaultAPISALESORDERSIMULATIONSRVServiceBatch;
/**
* <h3>Details:</h3><table summary='Details'><tr><td align='right'>OData Service:</td><td>API_SALES_ORDER_SIMULATION_SRV</td></tr></table>
*
*/
@Named("com.bosch.testvdm.services.DefaultAPISALESORDERSIMULATIONSRVService")
public class DefaultAPISALESORDERSIMULATIONSRVService
implements APISALESORDERSIMULATIONSRVService
{
@Nonnull
private final String servicePath;
/**
* Creates a service using {@link APISALESORDERSIMULATIONSRVService#DEFAULT_SERVICE_PATH} to send the requests.
*
*/
public DefaultAPISALESORDERSIMULATIONSRVService() {
servicePath = APISALESORDERSIMULATIONSRVService.DEFAULT_SERVICE_PATH;
}
/**
* Creates a service using the provided service path to send the requests.
* <p>
* Used by the fluent {@link #withServicePath(String)} method.
*
*/
private DefaultAPISALESORDERSIMULATIONSRVService(
@Nonnull
final String servicePath) {
this.servicePath = servicePath;
}
@Override
@Nonnull
public DefaultAPISALESORDERSIMULATIONSRVService withServicePath(
@Nonnull
final String servicePath) {
return new DefaultAPISALESORDERSIMULATIONSRVService(servicePath);
}
/**
* {@inheritDoc}
*
*/
@Override
@Nonnull
public DefaultAPISALESORDERSIMULATIONSRVServiceBatch batch() {
return new DefaultAPISALESORDERSIMULATIONSRVServiceBatch(this);
}
}
It works fine with SAP Cloud SDK version 3.3.1. All the methods are generated in the service.
By the way, it is weird that it is working fine for some OData services with version 3.7.
Update: Version 3.9.0 of the SAP Cloud SDK is available, containing the fix for this issue.
I had a look at this and found out that a new feature we added between those versions results in unexpected behavior.
For a quick workaround you could try to remove the <annotation>
blocks usually found at the end of the your edmx file.
We are looking into a fix for this and I will update this question once we have a fix available.