on 2024 Jan 12 4:11 PM
Hello CAP Community, Hi daniel.hutzel,
thanks to the answer from martin.stenzig3 at SAP CAP Dynamic Service Definition I was able to implement a functionality that loads a service definition plus it's JavaScript implementation from the database persistence. Check out srv/init.js where I fill the persistency and srv/server.js#L162 where the dynamic service is instantiated. With the REST Client script tests/app/dynamic.http#L20 I can execute the test to the hello-world function "hello" without problems.
But now I try to use that to replace the handler for an existing service (minimal.MinimalService). Unfortunately calling:
services[serviceDefinition.ServiceName] = await cds
.serve(serviceDefinition.ServiceName)
.from(csn)
.to("odata")
.at(serviceDefinition.ServicePath)
.with(eval(serviceDefinition.Implementation))
.in(cds.app);
has no effect and the response is:
Service \"minimal.MinimalService\" has no handler for \"hello\"
The usecase for this functionality is the following:
We already implemented a CAP Multitenant application using @sap/cds-mtxs that currently deploys new entities into an existing service using the functionality provided by cds.xt.ExtensibilityService. This gives us the benefit that all the deployment to the tenant specific HDI container is handled by cds-mtxs. That way also the generic handler implementations are triggered. But with a growing number of entities the metadata of the service gets hander to consume by the client applications. As the Entities belong already to a so called Environment we would like to create one service by Environment. cds.xt.ExtensibilityService does already support this. But until now we haven't found a way to set also our generic handlers for this new services.
Looking forward for your input.
Best Regards
Gregor
Request clarification before answering.
User | Count |
---|---|
75 | |
30 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.