Paul Hanssen
Paul Hanssen

Reputation: 235

PHP communicating with Java Server

G'day,

I have a project where I need to build a "live" java application (server) to hold state about domain objects (it's a private auction system). The java server will be communicating to and from PHP classes that hold the main back-end business functionality. The PHP classes will be stateless.

I need to communicate domain objects up to the java server (from PHP) so their state can be managed over time. Changes to the domain objects need to be saved back to the data store via calls to PHP classes on a web server.

I was thinking of wrapping my PHP classes using a XML-RPC class (e.g. Zend_Xmlrpc_Server) as they will be stateless. If/when the java application needs to write to the data store (by calling the correct PHP class method) it's a matter of using a XML-RPC client library class.

However, I'm not sure how I expose functionality in the java application so it can be reached by PHP method calls. Can anyone tell me the easiest way to do this in java ... do I just write a multi-threaded application and expose a socket? I'm after the right library classes to use to structure the java application with.

Cheers, Paul

Upvotes: 1

Views: 692

Answers (2)

Nick Holt
Nick Holt

Reputation: 34311

Expose your server-side Java code as a webservice.

There's countless ways to do this in Java but two that spring to mind are the EJB3 WS Annotations and Apache Axis.

As an aside, whichever technology you choose make sure you see it as a transport and keep the actual processing logic separate from it.

Upvotes: 4

mere-teresa
mere-teresa

Reputation: 434

Have you already experiment the PHP Java Bridge tool ?

Upvotes: 0

Related Questions