is it possible for PHP to call API written on java ? HELP

Reply

Join Date: Jun 2005
Posts: 5
Reputation: ms88 is an unknown quantity at this point 
Solved Threads: 0
ms88's Avatar
ms88 ms88 is offline Offline
Newbie Poster

is it possible for PHP to call API written on java ? HELP

 
0
  #1
Aug 13th, 2005
Hi there,

I have some problem with accessing API using PHP. Here is the story :
I use PHP as my main script on my webserver.
I want to retrieve data in database server (oversea).
The database server provides API and it's available to download.
So I download the API but dont know how to use it....
oh yes, the API is bundled in .jar file. There are example files but all of them are written in java and there are something about java rmi etc....

please help me to find a way to retrieve data from the database. can i use API? how to use it? is it possible for PHP to call API written on java


Thank you very much
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 274
Reputation: mmiikkee12 is an unknown quantity at this point 
Solved Threads: 5
mmiikkee12's Avatar
mmiikkee12 mmiikkee12 is offline Offline
Posting Whiz in Training

Re: is it possible for PHP to call API written on java ? HELP

 
0
  #2
Aug 14th, 2005
No, but you could use JSP...
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: is it possible for PHP to call API written on java ? HELP

 
0
  #3
Aug 14th, 2005
Or write a Java program that runs constantly and can communicate in some way (probably through SOAP) with your PHP application and use that as middleware.

But indeed, moving to a JSP/Servlet environment is the best option by far.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 5
Reputation: ms88 is an unknown quantity at this point 
Solved Threads: 0
ms88's Avatar
ms88 ms88 is offline Offline
Newbie Poster

Re: is it possible for PHP to call API written on java ? HELP

 
0
  #4
Aug 14th, 2005
Thank you very much for the replies.....
I already setting up the apache using php_java bridge and it works well (the PHP can access all java class, such as java.lang etc).....

yes, write java application and php connect to the java application could be possible. However, im not quite sure how to call the class. There is a java example using the API which is run in command line. To run or compile this example, i have to call : java -classpath .:../<API jar file> <classname>...........how can avoid this problem?

another question : The class which i want to call is in jar file. It's in directory, say : aaa/bbb/ccc/ddd/eee......how to instantiate a class which is in a sub directories?

is it possible for me to just instantiate the API class (API available from the database server) and call the methods on it?


Cheers.....
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 1
Reputation: albertolarrea is an unknown quantity at this point 
Solved Threads: 0
albertolarrea albertolarrea is offline Offline
Newbie Poster

Re: is it possible for PHP to call API written on java ? HELP

 
0
  #5
Jun 9th, 2009
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,555
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 454
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: is it possible for PHP to call API written on java ? HELP

 
0
  #6
Jun 9th, 2009
Originally Posted by ms88 View Post
Thank you very much for the replies.....
I already setting up the apache using php_java bridge and it works well (the PHP can access all java class, such as java.lang etc).....

yes, write java application and php connect to the java application could be possible. However, im not quite sure how to call the class. There is a java example using the API which is run in command line. To run or compile this example, i have to call : java -classpath .:../<API jar file> <classname>...........how can avoid this problem?

another question : The class which i want to call is in jar file. It's in directory, say : aaa/bbb/ccc/ddd/eee......how to instantiate a class which is in a sub directories?

is it possible for me to just instantiate the API class (API available from the database server) and call the methods on it?


Cheers.....
I am guessing that "aaa/bbb/ccc/ddd/eee" is a package name. So, use aaa.bbb.ccc.ddd.eee.YourClassName. Make sure that the path of .jar must added with CLASSPATH env; variable.
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC