Jump to content

PHP-JAVA - What remoting protocol to use? Best practice?


mazaka

Recommended Posts

Hi all

 

Our core app is built in java. I need to connect a PHP app (interface) to it in the best way possible.

By connecting, I mean the PHP is requesting data from the Java a fair amount of times during one user's session.

 

I looked at HessianPHP as a possible solution, but that project seems a bit deserted.

Are there any better options than XML-RPC /NuSOAP / SOAP?

 

Anyone has as any experiences?

 

thanks!

 

Pelle

 

Link to comment
Share on other sites

Facebook recently released a platform called Thrift which acts as a bridge between multiple languages.  They boast it being very fast and easy to use.

 

I think that probably the best way is to make a web service.  For instance you might have Java running as a backend web service with access to the databases.  It would expose a set of methods to read and write to the database.  Then your front end servers would run PHP.  They would make calls to the back end server retrieve data (serialized, in XML most likely, think SOAP) and then do whatever was needed to present the data to the client.  By going this route you make it relatively easy to add more servers to the application, so it will scale well. By using XML you leave open the option to switch your backend or frontend implementations to other languages in the future, or expose the services for public consumption as an API.

Link to comment
Share on other sites

I am currently working on a similar issue.  I found an open-source eclipse based reporting software that I'm hoping I can use to quickly build reports for our clients.  It's Java-based so my initial plan is to install a Tomcat server for the reporting and request reports through PHP.  However, I think I'm running into memory constraints on our VPS so I'm not sure how it's going to turn out.

 

I'd be curious to hear how you go about solving this issue or what anyone else has to offer.

Link to comment
Share on other sites

Thanks everyone for quick and great replies!

 

+ I looked at the http://us3.php.net/java initiative. It seems like its firing up a java VM for every request? I may be wrong but if im not, it sounds kind of costly.

 

+ I totally forgot about Thrift. Havent seen the code til today so I need to look some more at it.

 

+ We are leaning towards using something like XML-RPC or SOAP at the moment. Just found out about CodeIgniter and its XMLRPC plug:

http://codeigniter.com/user_guide/libraries/xmlrpc.html - Could be a potential combo since we dont have a framework chosen for PHP just yet.

Anyone had any experience with it? We will be making a lot of RPC calls. Not casual stock quote lookups.. :)

 

+ The Zend SOAP library looks interesting if we take the SOAP path. Written in C, compared to others. http://devzone.zend.com/node/view/id/689#Heading3

 

While looking robust and rigorous, SOAP to me still feels a bit complex and the word overkill comes to mind.

I will prioritize agility over being WorldWar3 proof. Any thoughts on SOAP and its complexity?

Link to comment
Share on other sites

I think the common complaint against SOAP is that it is too verbose.  You could take a look at REST and see if that protocol can fit into what you're doing.  In the worst case you could simply not use an established protocol at all and write your own.  The benefit would be it fits your needs perfectly, the drawback would be it is unlikely to work with other services, but that may not be a bad trade off depending on your goals.

 

I haven't used code ignitor, though I've heard good things about it.  I've also heard good things about the Zend framework.  Frankly, I think so long as you're comfortable working within their environments any framework will do.

 

Roopurt if you're just tryig to draw graphs I'm not sure why you're making a remote service.  Given the fact that graphs are usually outputed as images or flash it would seems very costly to send them over the wire.  There is a good PHP-flash graph drawing package you could use.  http://www.maani.us/charts/index.php

 

If you're using the java package because it queries the databases for the right combinations of data, and you're running into problems deploying the java server, then I would just look over the source code to determine what dimensions it's fetching from the DB and then port that over to PHP.  All of that said I may be misunderstanding you, so why don't you start a new thread on the issue?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.