NYCPHP Meetup

NYPHP.org

[nycphp-talk] Struts and PHP

Jayesh Sheth jayeshsh at ceruleansky.com
Mon May 2 18:44:00 EDT 2005


Hi guys,

I think that Zend is working on a new replacement for the old Java-PHP
bridge. I remember reading that somewhere, but I don't remember exactly
where. Perhaps I am wrong, but maybe a little Googling will help me
remember better.

Also - another easy way to connect a Java struts system to a set of PHP
scripts would be web services (XML-RPC or SOAP). You might be able to run
the Struts system on the standard port 80 in Apache, and PHP on port 81,
or somerthing. Then, if the Struts application needs to get information
from a PHP script, and if there is a Java XML-RPC client similar to the
jsolait one for JavaScript, then you could do something like (please
'translate' this JavaScript code to Java in your heads):

var serviceURL = "http://localhost:81/my_php_script.php";
var methods = [];

try
{
var service = new xmlrpc.ServiceProxy(serviceURL, methods);
document.write( service.sayHello() );
}

catch(e)
{
alert('Oops, that did not work out.');
}

So, the idea is to create a ServiceProxy object in Java, and call PHP
'methods' as if they were part of a local PHP object.

Hope that makes sense ...

- Jay




More information about the talk mailing list