Trying to create custom OData v2 service with data source from S/4HANA Cloud using S/4HANA Cloud SDK

后端 未结 1 364
梦谈多话
梦谈多话 2021-01-28 09:55

I am trying to create a custom OData v2 service in java with an S/4HANA Cloud data source using S/4HANA Cloud SDK. I tried to follow section 8.3 of the SAP Press book \"Extendi

1条回答
  •  北荒
    北荒 (楼主)
    2021-01-28 10:21

    The setup for OData V2 provisioning looks a bit different. So remove all modifications you did to use OData V4 provisioning. Then add the following:

    1. Add the following dependencies (instead of the odata-v4 one) to your application/pom.xml file:

      
          com.sap.cloud.servicesdk.prov
          odata2.web
          
              
                  javax.servlet
                  servlet-api
              
          
      
      
          com.sap.cloud.servicesdk.prov
          odata2.xsa
      
      
          com.sap.cloud.servicesdk.prov
          odatav2-hybrid
          
              
                  javax.servlet
                  servlet-api
              
          
      
      
          com.sap.cloud.servicesdk.prov
          odatav2-prov
      
      
    2. Add the following entries to your application/src/main/webapp/WEB-INF/web.xml file, replacing YOUR.PACKAGE with a package to search for your OData endpoints:

      
          ODataServlet
          org.apache.olingo.odata2.core.servlet.ODataServlet
          1
          
              org.apache.olingo.odata2.service.factory
              
                  com.sap.cloud.sdk.service.prov.v2.rt.core.CloudSDKODataServiceFactory
              
          
          
              org.apache.olingo.odata2.path.split
              1
          
      
      
          ODataServlet
          /odata/v2/*
      
      
          package
          YOUR.PACKAGE
      
      
          
              com.sap.cloud.sdk.service.prov.v2.rt.core.web.ServletListener
          
      
      
    3. Add an OData V2 edmx file to the application/src/main/resources/edmx directory.

    These steps should get your OData V2 Provisioning service up and running.

    0 讨论(0)
提交回复
热议问题