cancel
Showing results for 
Search instead for 
Did you mean: 

CAP: Invoking an external ODATA Service via Java

prabalrakshit
Employee
Employee
0 Kudos

Hello All,

I am trying to invoke an external ODATA Service using the CAP Java framework. I am following this example of invoking the OData NorthWind service (although it is NodeJS). https://blogs.sap.com/2020/05/26/cap-consume-external-service-part-1/

I have done the following:

1. Import the EDMX file

2. Generate the CSN file and update the package.json

3. Create a service definition in form of a CDS file.

As recommended by this example. I am attempting to create a handler, wherein a call needs to be made out to the external ODATA service. However I am not able to proceed with the exact CDS command to connect to an ODATA service. Looking at guidance on how to write code like this NodeJS snippet

	const { Products } = this.entities;
	const service = await cds.connect.to('NorthWind');
	this.on('READ', Products, request => {
		return service.tx(request).run(request.query);
	});

Any suggestions or pointers on this will be highly appreciated.

Regards,

Prabal Rakshit

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
Active Contributor
0 Kudos

Have you tried Triggering Custom Events