Test RESTful web services

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Test RESTful web services

Postby marco.rossi » Wed Aug 09, 2023 11:00 am

Good morning,
does exist a way to test the web services into the servoy developer? https://wiki.servoy.com/display/DOCS/RE ... b+Services
Ex: by using an external client to create a get request and getting a response from the servoy developer in which I can put a breakpoint on the underneath code.

I see the admin page listens over the servoy developer port so I was wondering if the defined REST apis do as well.

Thanks
Marco
Marco Rossi
Senior Analyst Developer
Freelance Consultant

IT Manager @Mantho
Webmaster @Sitoliquido
marco.rossi
 
Posts: 110
Joined: Sun Apr 12, 2015 9:33 pm

Re: Test RESTful web services

Postby mboegem » Wed Aug 09, 2023 11:17 am

marco.rossi wrote:does exist a way to test the web services into the servoy developer?

Can't you use Postman for that?

marco.rossi wrote:I see the admin page listens over the servoy developer port so I was wondering if the defined REST apis do as well.

Of course, it's just another solution
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Test RESTful web services

Postby marco.rossi » Thu Aug 10, 2023 11:53 am

Hi Marc,
thank you for your reply.

Can't you use Postman for that?

Yes, I am already using Postman to test the REST APIs when they are up and running on a real Tomcat server.

However, what I would like to do is test an API within the Servoy Developer for code testing purposes.
Let's assume that my local Servoy Developer installation is on port 8183, and I have a standalone Tomcat on which I load my war file on port 8383.

When I run my REST APIs on port 8383, everything works smoothly. I receive the expected response in Postman, complete with my custom message based on the processing performed.

The issue arises when I attempt to run the exact same GET request while switching to port 8183.
This is the port on which my developer should be listening since it is used for the admin page. In this case, I receive a 404 (not found) error.


Thank you once again for your assistance.

Best regards,
Marco
Marco Rossi
Senior Analyst Developer
Freelance Consultant

IT Manager @Mantho
Webmaster @Sitoliquido
marco.rossi
 
Posts: 110
Joined: Sun Apr 12, 2015 9:33 pm

Re: Test RESTful web services

Postby mboegem » Thu Aug 10, 2023 12:11 pm

Hi Marco,

If the API solution is active in developer I don't see a reason why it shouldn't work.
I'm doing this all the time.

Are you sure you're using the correct URL?
A major difference could be that you are deploying your solution as 'rossi.war' this would need a URL like this:
Code: Select all
http://localhost:8383/rossi/servoy-service/rest_ws...........


Servoy developer always runs the solution in the tomcat ROOT, so the URL looks like this:
Code: Select all
http://localhost:8183/servoy-service/rest_ws...........


Hope this helps
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Test RESTful web services

Postby marco.rossi » Mon Aug 14, 2023 1:21 pm

Hi Marc,
thanks for the answer.

I didn't try it yet but I feel you're 100%, I probably just forgot to remove the subfolder when I call the developer :roll:

Thanks for the help!
Marco Rossi
Senior Analyst Developer
Freelance Consultant

IT Manager @Mantho
Webmaster @Sitoliquido
marco.rossi
 
Posts: 110
Joined: Sun Apr 12, 2015 9:33 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 15 guests

cron