首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Java生成器在SAP版本3.7.0的API_SALES_ORDER_SIMULATION_SRV中不能正常工作

Java生成器在SAP版本3.7.0的API_SALES_ORDER_SIMULATION_SRV中不能正常工作
EN

Stack Overflow用户
提问于 2019-11-20 01:32:04
回答 1查看 340关注 0票数 1

我使用Java生成器使用SDK原型项目生成服务类,版本为3.7.0。

我使用的OData服务是API_SALES_ORDER_SIMULATION_SRV。我从SAP业务中心下载了元数据。实际上,我也在1909年的前提下测试了S/4HANA上的元数据。这个问题仍然存在。

我在pom.xml中使用的插件如下所示:

代码语言:javascript
复制
<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>

生成的服务接口/类是APISALESORDERSIMULATIONSRVService和DefaultAPISALESORDERSIMULATIONSRVService。有些方法在服务中丢失了。例如createSalesOrderSimulationAPI()。

代码语言:javascript
复制
/*
 * 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);
        }

    }

它在版本3.3.1中运行良好。所有方法都在服务中生成。

顺便说一句,对于一些版本为3.7的OData服务来说,它运行得很好,这是很奇怪的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-11-20 11:03:08

更新: SAP的3.9.0版本已经可用,包含了解决此问题的方法。

我看了一下,发现我们在这些版本之间添加的一个新特性会导致意外的行为。

为了快速解决问题,您可以尝试删除通常在edmx文件末尾找到的<annotation>块。

我们正在调查这个问题的解决方案,一旦我们有了解决办法,我会更新这个问题。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58945346

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档