OData Mock Service
This repository also contains a simple Node.js-based server, which represents the OData simulation server in the branch simulation server. The server can test the SAP S/4HANA integration function of the SAP S/4HANA Cloud SDK without accessing the SAP S/4HANA system. The server hosts an OData v2 simulation service that mimics the business partner API of SAP S/4HANA Cloud to a certain extent.
If there is no SAP S/4HANA system available, the simulated server can be used as a substitute for simple testing and experimentation of the SAP S/4HANA Cloud SDK. It is tailored specifically to the examples in this book. This page explains how to run the simulated server and how to integrate it into the test of the sample application.
Note: The server does not have any security measures. The risk of running the server is at your own risk and is only for experimentation. Don't use servers to store any personal data-only use fake data.
How to run the server
After cloning this repository, check the branch simulation server. Or, download this archive and unzip it to your local computer. All the following steps should be performed in the folder where you checked out or extracted the simulation server code.
Before starting the simulation server, you need to manually put the metadata EDMX document of the business partner OData service into the folder business-partner and prepare the document:
- Go to the description of the business partner API in the SAP API Business Center.
- Click Log in and log in with your credentials (you may need to register beforehand).
- Click the Details tab, then click Download Specification and select EDMX.
- Store the downloaded file named API_BUSINESS_PARTNER.edmx in the subfolder business-partner of the simulation server folder.
- Open the file API_BUSINESS_PARTNER.edmx in a text editor and find the line containing EntityType Name="A_BusinessPartnerType". In this EntityType, add the following two lines after the line containing \</Key>:
<Property Name="YY1_AddrLastCheckedOn_bus" Type="Edm.DateTime" Precision="0" sap:display-format="Date" sap:label="Addresses Last Checked On"/>
<Property Name="YY1_AddrLastCheckedBy_bus" Type="Edm.String" MaxLength="50" sap:label="Addresses Last Checked By"/>
After preparing the simulation server, you can run the simulation server on your local computer ( http://localhost:3000) or SAP Cloud Platform, Cloud Foundry, as described in either of the following two parts.
Launch the mock server
npm install
npm start
Wait until you see that the output mock server has started. Access the simulated OData service at http://localhost:3000/sap/opu/odata/sap/API_BUSINESS_PARTNER (no credentials required). This should have the following output.
{"d":{"EntitySets":["A_BusinessPartner","A_BusinessPartnerAddress"]}}
To see a sample response from a business partner, please visit http://localhost:3000/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。