Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Communicating w/ Java program

Tags:

java

php

We're come across a problem here at my company and I'm trying to find the best solution.

Software was recently purchased that utilizes a Java program to get the tax for a certain shipment. The site that needs this was written in PHP4. How can I communicate between the two?

It was suggested to use files to communicate but that was horribly slow since the Java program needed to be recompiled every time. So, what is the best solutions to this:

  1. Create a mutli-threaded Java server and use PHP to send/receive the info.
  2. Some other type of file-writing method
  3. Something cool that I dont even know about.

Thanks in advance!

Edit: I understand the importance of web services but why would this be more efficient that using a mutli-threaded socket-based java server? The only thing connecting to this web services will be my PHP program, no one else. It seems like it might be overkill for my simple task. Am I mistaken? If so, why? Thanks.

like image 588
frio80 Avatar asked Jan 24 '23 07:01

frio80


1 Answers

Wrap the Java program in a Web Service, and invoke it from PHP. You can even use caching in the Web Service, to optimize performance.

like image 181
João Silva Avatar answered Jan 25 '23 20:01

João Silva