cancel
Showing results for 
Search instead for 
Did you mean: 

How to consume one capm service in another capm service?

VenkyM
Participant
0 Kudos

Hello all,

I have two capm services serviceA and serviceB in two different capm projects. I need to call serviceB in serviceA and these two services are deployed in SAP BTP.
Is there a way to communicate and send data from serviceA to serviceB?
Any help is appreciated?
Thank you.

View Entire Topic
MioYasutake
Active Contributor
0 Kudos

@VenkyM 

You can find how to consume external services from CAP application in the document below:

https://cap.cloud.sap/docs/guides/using-services

VenkyM
Participant
0 Kudos


Hello @MioYasutake 
Thank you for your response.
Will it work from two CAPM services in two different CAM projects?
Should I use destinations or cds.connect(). Please clarify.

MioYasutake
Active Contributor
0 Kudos

@VenkyMIf you want to call serviceB from serviceA, please follow below steps:

  1. Create a destination for serviceB
  2. Import metadata of serviceB in the project of serviceA
  3. Use `cds.connect.to('ServiceB')` to connect to the serviceB
  4. Add the following configuration to package.json before deployment

 

"cds": {
  "requires": {
    "ServiceB": {
      "kind": "odata",
      "model": "srv/external/ServiceB",
      "[production]": {
        "credentials": {
          "destination": "<destination for serviceB>",
          "path": "/path/to/ServiceB"
        }
      }
    }
  }
}