1

I have made a JavaFx aplication that also needs to be controlled remotely. I currently have another JavaFX aplication that does it using sockets.

Now I need to replace the second app with a php web app. What would be the best way to send and receive data from and to my Java aplication.

It will be one PHP web app that will controll many Java aplications.

Samuel Liew
  • 68,352
  • 105
  • 140
  • 225
Sila Siebert
  • 382
  • 2
  • 9

1 Answers1

0

Can your java application provide a restful service? Then every software (and language) you want can consume this api with web request.

You can simplify your javaFx application so that it would be a simple UI only to consume a restful api and maybe some caching.

This refactoring would lead to a server <-> client architecture.

Charlie
  • 1,126
  • 2
  • 14
  • 30
  • I have never worked with restful services. The purpose of JavaFX is to be able to use the app locally aswell. Thanks for the tip – Sila Siebert Aug 26 '19 at 20:55
  • May you want to read a little more about this architecture. Then I can recommend the fowler literature https://martinfowler.com/articles/enterpriseREST.html. Also please mark my solution as accepted or/and upvote if you liked it. – Charlie Aug 26 '19 at 21:38
  • Just to add, that REST is good if you're opening your service to public facing web clients. You lose a lot of the benefits of a compiled, static language like Java. REST puts everything into JSON/XML. If you are not opening up to public facing web clients (as in for web sites), you should look into SOAP instead, or again, use THRIFT. – trilogy Aug 27 '19 at 14:51
  • SOAP and REST can't be compared directly, since the first is a protocol (or at least tries to be) and the second is an architectural style. This is probably one of the sources of confusion around it, since people tend to call REST any HTTP API that isn't SOAP. See this thread https://stackoverflow.com/questions/19884295/soap-vs-rest-differences – Charlie Aug 31 '19 at 22:23
  • @Charlie no one is comparing them, I’m stating that you should use SOAP to retain some object oriented goodness. – trilogy Sep 27 '19 at 14:26
  • SOAP allows processes running on disparate operating systems (such as Windows and Linux) to communicate using Extensible Markup Language (XML). (https://en.wikipedia.org/wiki/SOAP) – Charlie Sep 29 '19 at 18:18