<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: CAP Node.JS: Replace implementation of existing service in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/cap-node-js-replace-implementation-of-existing-service/qaa-p/12820293#M4814519</link>
    <description>&lt;P&gt;I have noticed that as well. Creating an new one is working well, but there does not seem to be any way to change/destroy one at runtime that I have found. &lt;/P&gt;</description>
    <pubDate>Fri, 12 Jan 2024 16:14:59 GMT</pubDate>
    <dc:creator>martinstenzig</dc:creator>
    <dc:date>2024-01-12T16:14:59Z</dc:date>
    <item>
      <title>CAP Node.JS: Replace implementation of existing service</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-node-js-replace-implementation-of-existing-service/qaq-p/12820292</link>
      <description>&lt;P&gt;Hello CAP Community, Hi &lt;SPAN class="mention-scrubbed"&gt;daniel.hutzel&lt;/SPAN&gt;,&lt;/P&gt;
  &lt;P&gt;thanks to the answer from &lt;SPAN class="mention-scrubbed"&gt;martin.stenzig3&lt;/SPAN&gt; at &lt;A href="https://answers.sap.com/answers/13833157/view.html" target="_blank"&gt;SAP CAP Dynamic Service Definition&lt;/A&gt; I was able to implement a functionality that loads a service definition plus it's JavaScript implementation from the database persistence. Check out &lt;A href="https://github.com/gregorwolf/bookshop-demo/blob/main/srv/init.js" target="_blank"&gt;srv/init.js&lt;/A&gt; where I fill the persistency and &lt;A href="https://github.com/gregorwolf/bookshop-demo/blob/main/srv/server.js#L162" target="_blank"&gt;srv/server.js#L162&lt;/A&gt; where the dynamic service is instantiated. With the REST Client script &lt;A href="https://github.com/gregorwolf/bookshop-demo/blob/main/tests/app/dynamic.http#L20" target="_blank"&gt;tests/app/dynamic.http#L20&lt;/A&gt; I can execute the test to the hello-world function "hello" without problems. &lt;/P&gt;
  &lt;P&gt;But now I try to use that to replace the handler for an existing service (minimal.MinimalService). Unfortunately calling:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;      services[serviceDefinition.ServiceName] = await cds
        .serve(serviceDefinition.ServiceName)
        .from(csn)
        .to("odata")
        .at(serviceDefinition.ServicePath)
        .with(eval(serviceDefinition.Implementation))
        .in(cds.app);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;has no effect and the response is:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt; Service \"minimal.MinimalService\" has no handler for \"hello\"&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;The usecase for this functionality is the following:&lt;/P&gt;
  &lt;P&gt;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.&lt;/P&gt;
  &lt;P&gt;Looking forward for your input.&lt;/P&gt;
  &lt;P&gt;Best Regards&lt;BR /&gt;Gregor&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 16:11:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-node-js-replace-implementation-of-existing-service/qaq-p/12820292</guid>
      <dc:creator>gregorw</dc:creator>
      <dc:date>2024-01-12T16:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: CAP Node.JS: Replace implementation of existing service</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-node-js-replace-implementation-of-existing-service/qaa-p/12820293#M4814519</link>
      <description>&lt;P&gt;I have noticed that as well. Creating an new one is working well, but there does not seem to be any way to change/destroy one at runtime that I have found. &lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 16:14:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-node-js-replace-implementation-of-existing-service/qaa-p/12820293#M4814519</guid>
      <dc:creator>martinstenzig</dc:creator>
      <dc:date>2024-01-12T16:14:59Z</dc:date>
    </item>
  </channel>
</rss>

