Page 1 of 1

Multiple Solutions with Same REST Module

PostPosted: Thu Aug 13, 2020 12:40 am
by Louis.Winter
Hello All,

Background:
We have 2 solutions/apps (1 for external customers the other for internal use only) that run on the same Apache Tomcat instance. I am working on putting together a dashboard to show our support reps the active users logged into these apps. I created a module with 1 form ("ActiveUsers_v1") with a ws_read() function that uses plugins.clientmanager.getConnectedClients() to get the list of users to return. When testing in the Servoy Developer with either solution the REST calls work just fine using the following url:
Code: Select all
http://localhost:8080/servoy-service/rest_ws/WS/v1/ActiveUsers


Issue:
The 2 apps run just fine in my QA environment (single Apache Tomcat instance with 2 solutions). When I try testing the new REST calls it only works for 1 of the solutions, which happens to be the first solution (I'll call it App_A). When I make the call to App_B, it returns the following:
Code: Select all
<html>

<body>No Servoy web service found for '
   rest_ws
   '</body>

</html>

I can see the headless client start in App_A but not in App_B.

I'm using Postman to test these services using the following urls:
Code: Select all
http://x.x.x.x:8080/App_A/servoy-service/rest_ws/WS/v1/ActiveUsers
http://x.x.x.x:8080/App_B/servoy-service/rest_ws/WS/v1/ActiveUsers


Do I need to configure something differently for the headless client/REST to work in both solutions?

Louis

Re: Multiple Solutions with Same REST Module

PostPosted: Thu Aug 13, 2020 9:58 am
by ROCLASI
Hi Louis.

In the Servoy wiki it says the URL is structured like so:
Code: Select all
{serverUrl}/servoy-service/rest_ws/{solutionName}/{formName}/{someValue}/{anotherValue}

I assume your form name is WS, so that would make your URLs like this:
Code: Select all
http://x.x.x.x:8080/servoy-service/rest_ws/App_A/WS/v1/ActiveUsers
http://x.x.x.x:8080/servoy-service/rest_ws/App_B/WS/v1/ActiveUsers


Hope this helps.

Re: Multiple Solutions with Same REST Module

PostPosted: Thu Aug 13, 2020 4:47 pm
by Louis.Winter
Robert,

Thanks for the suggestion, I tried the format you provided and unfortunately it doesn't work for either app. Based on another post I ran across I checked the repository database and found a record for WS in the servoy_root_elements table (that was the only record in the table). I deleted this record, completely undeployed both apps, restarted Apache, and redeployed the 2 apps. This worked, the 2 URLs I was using originally both work correctly.

For what it's worth, WS is the module name and the form name is actually "ActiveUsers_v1". I believe the versioning is a relatively new feature.