cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming on-Premise Service in CAP Project

sPatil
Participant
0 Kudos
591

Hi Team,

I am trying to consume an on-premise service in the CAP project using the destination. My SAP BTP Subaccount is connected to on-premise system via Cloud Connector.

In my existing CAP project, I have added the External Service (on-premise) by following steps as --> Service Center > Select Provider as 'SAP SYSTEM' > Catalog of Services as <my on-premise system> > Selected the service that I want > Selected the Entity that I wanted to add in my existing CAP project. (as shown in below screenshot)

sPatil_0-1714051027505.png

Once service has been added in the CAP project, then automatically one 'external' folder along with one .cds file & one .js file got added in srv folder and in package.json file below changes got added. 

( below code is in package.json > cds > requires )

sPatil_2-1714051674640.png

Then I have build & deployed the MTA project. When I run the external service from the deployed applications at space level then I am getting 502 error as 'Error during request to remote service: Failed to load destination.' (as shown in below screenshot)

sPatil_1-1714051490702.png

Note - 1) This destination is used by UI team where it is working fine. 2) We are not able to get the service data even in local testing by cds watch.

Thanks in advance!

 

 

View Entire Topic
MioYasutake
Active Contributor

@sPatil 

Please check the mta.yaml file to ensure that the destination and connectivity service instances are defined in the resources section and bound to your service.

https://cap.cloud.sap/docs/guides/using-services#add-required-services-to-mta-deployments

MioYasutake_0-1714213462655.png

 

 

sPatil
Participant
0 Kudos

Hi Mio,

I have added the necessary details in the resources section of mta.yaml file. Kindly check below screenshot and let me know if I am missing anything.

sPatil_0-1714133087629.png

Also, the link provided by you in the above answer is not working. Please check the same.

Thanks in advance.

MioYasutake
Active Contributor
0 Kudos
@sPatil I have corrected the link. It looks that a destination service is already defined in the mta.yaml. You also need connectivity service as your backend is on-premise. Additionally, please check that both destination and connectivity services are bound to your service.
LucasMagriniRigo
Explorer
0 Kudos

@MioYasutakethank you. It was precisely it.

I have now a timeout error but that's another issue.