开发者

PHP web application calling a Java application

I need to develop a web application using PHP an开发者_JS百科d the Apache web server. The application should call an external Java-based application which is stored in the host computer and pass the user's input value to this application which will analyse it and do something. I have been reading articles about PHP/Java and it seems that the best solution is to integrate a PHP into a Java servlet environment such as PHP/JavaBridge. As I am not an expert on web development and pretty ignorant on PHP, can someone tell me if this is the best solution and if not, what other possible approaches should I use it? Thanks in advance!


The application should call an external Java-based application which is stored in the host computer and pass the user's input value to this application which will analyse it and do something.

WebServices are perfectly suited here.

Also See

  • how-to-easily-consume-a-web-service-from-php
  • Java WebServices


You could do something like this:

$parameter1='your';
$parameter2='parameters';

$output = shell_exec("java whatever.jar $parameter1 $parameter2");

echo $output;

* Update *

I do agree with Jigar Joshi, though. I think a web service would be the best option here.


You may explose your already existing java application api as web-services (jax-ws or jax-rs) and then use any application to call that. So you can write an web-wrapper around your java-webapp and then call it. First approach it better approach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜