This blog will detail the setup of an SAP Commerce mock application as a microservice in the Kyma environment. The
xf-application-mocks contain lightweight substitutes for SAP applications to ease the development and testing of extension and integration scenarios. In conjunction with the SAP Cloud Platform Extension Factory, the efficient implementation of application extensions is supported without the need for real SAP applications being accessible during development.
If you are new to the C/4HANA Extensibility topic please see this
blog to get started.
Open the
SAP C/4HANA Cockpit and choose the
Extensibility menu option and then open the console of your Kyma instance.
First verify that the Cluster Add-ons for the mock apps is existing by choosing the menu option
Cluster Addons and verify that there is an entry pointing to
github.com/sap/xf-addons//addons/index.yaml?ref=latest
Otherwise choose the
Add New Configuration button and add and entry for the url as shown below.
Start by creating a new namespace with the name
mocks.
Within the mocks namespace choose the
Catalog menu option and then choose the
SAP Commerce Cloud - Mock
Choose
Add once to create a service instance
Accept the default properties and choose
Create Instance
This will result in a service being added to the namespace which can be seen in the Kyma home workspace.
Open the
mocks namespace and then choose the
APIs menu option and finally choose the
commerce-mock service
This will show the exposed api’s address, which should be
https://commerce-mocks.{yourDomain}
Use the url to open the mock application.
In the next steps we will utilize the
SAP Cloud Platform Extension Factory to establish a connection between the mocking application and the Kyma instance. This will allow us to use the mocking application to send events to Kyma and utilize the mocking APIs.
Open the
SAP C/4HANA Cockpit and choose the
Extensibility menu option and then choose your Kyma instance
This will bring us to the
Runtime Details where you can initiate the system registration by choosing the Add button found on the
Registered Systems list.
Provide a Name for the System and choose Register to save the entry.
Choose the Copy key button which will place the URL needed to connect the systems to your system’s clipboard.
With the key copied, proceed back to the mocking application to complete the system connection.
In the commerce mock application choose the Connect button and paste the token url into the field.
You should now see the systems connected. Use the
Batch Registration button or the individual
Register buttons to register the APIs.
This should now be reflected in the
commerce-mock application within Kyma under the
Provided Services & Events table.
Check out this
blog to learn how to trigger a Lambda function with an event or this
blog to learn how to trigger a microservice with an event