How to interact with a Live java process from php?

S

Sophia

Hi,

My question is pretty much what the title describes. My situation is:
The essential task is to provide a service to web user. This service
can only be accessed from a java program on the backend, and this
program, unfortunately, is a 24/7 live process. My teammate is going
to write a php program to handle the front end request, so my question
is that, is it possible for such a design to work? If it is, how?

Any help is greatly appreciated!

Sophia
 
I

IchBin

Sophia said:
Hi,

My question is pretty much what the title describes. My situation is:
The essential task is to provide a service to web user. This service
can only be accessed from a java program on the backend, and this
program, unfortunately, is a 24/7 live process. My teammate is going
to write a php program to handle the front end request, so my question
is that, is it possible for such a design to work? If it is, how?

Any help is greatly appreciated!

Sophia
Have not done it but here some information. Google for PHP Java.

http://us3.php.net/java
http://php-java-bridge.sourceforge.net/
http://www.phpbuilder.com/manual/ref.java.php
http://www.onlamp.com/pub/a/php/2001/06/14/php_jav.html

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
S

Sophia

Thanks IchBin,
I understand that there are ways to initiate a java instance from php
program. But I was talking about communicate to a running java
process. Right now, what I can think of is the old way of socket
programming, that is, the java program and the php program send xml
request/reply to each other via unix sockets. Any better ideas?
 
I

IchBin

Sophia said:
Thanks IchBin,
I understand that there are ways to initiate a java instance from php
program. But I was talking about communicate to a running java
process. Right now, what I can think of is the old way of socket
programming, that is, the java program and the php program send xml
request/reply to each other via unix sockets. Any better ideas?
Sorry, I am not to strong with PHP.

--

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
G

Gordon Beaton

I understand that there are ways to initiate a java instance from
php program. But I was talking about communicate to a running java
process. Right now, what I can think of is the old way of socket
programming, that is, the java program and the php program send xml
request/reply to each other via unix sockets. Any better ideas?

"Old" sockets are a natural choice for communicating with an existing
process. This is especially the case when the two components are
written using different languages or technologies. If you want
alternatives, describe why sockets are not suitable.

/gordon
 
D

Dimitri Maziuk

Sophia sez:
Thanks IchBin,
I understand that there are ways to initiate a java instance from php
program. But I was talking about communicate to a running java
process. Right now, what I can think of is the old way of socket
programming, that is, the java program and the php program send xml
request/reply to each other via unix sockets. Any better ideas?

Depending on what you need to do, sockets, named pipes (fifos),
a php module that talks rmi, php corba module. In the simple case
I'd probably dump xml and use a less bloated exchange format.

Dima
 
S

Sophia

Hi Gordon,

Sockets are actually one of the things i used most in my school
projects, you are right, they are good for communicating between
different processes/langs. My doubt was that in socket programming,
the programmer pretty much handles everything above tcp/ip layer, in a
real project when reliability is essential, is it safer to use some
established frameworks? Say in my project, if there are 100 users
hitting the php pages at the same time, thus 100 socket connection
requests to my Java or C++ program, what do I need to do to provide a
reliable service?

Sorry if my language is very vague, I am neither an experienced
programmer nor a native English speaker.
 
S

Sophia

Hi Gordon,

Sockets are actually one of the things i used most in my school
projects, you are right, they are good for communicating between
different processes/langs. My doubt was that in socket programming,
the programmer pretty much handles everything above tcp/ip layer, in a
real project when reliability is essential, is it safer to use some
established frameworks? Say in my project, if there are 100 users
hitting the php pages at the same time, thus 100 socket connection
requests to my Java or C++ program, what do I need to do to provide a
reliable service?

Sorry if my language is very vague, I am neither an experienced
programmer nor a native English speaker.
 
S

Sophia

Thanks Dima, I am curious that why you think <xml> is a bloated
exchange format. To me, It looks like of the same class of pure txt
(with some descriptive tags).
 
D

Dimitri Maziuk

Sophia sez:
Thanks Dima, I am curious that why you think <xml> is a bloated
exchange format. To me, It looks like of the same class of pure txt
(with some descriptive tags).

Yeah, if you treat it like "text with a few descriptive tags",
it is that. OTOH, consider a table of numbers, say, ID, value,
error. Depending on how you structure your DTD and name the
tags, e.g.
<id>1</id><val>1.2</val><err>0.005</err>
this is 40 characters total, 10 characters of data per row:
75% overhead. Plus there should be a dtd lurking somewhere.

It really depends on your application, obviously.

Dima
 
P

peter

Hello!
I understand that there are ways to initiate a java instance from php
program.

It doesn't initiate a java instance. At least the php-java-bridge
communicates with the java server via plain html.
I can think of is the old way of socket programming

Hmm, what about a servlet engine and then post the data to the servlet.
This should be trivial to implement
program send xml
request/reply to each other via unix sockets

Probably. But unix sockets are said to be much slower than pipes:
http://sourceforge.net/mailarchive/forum.php?thread_id=9464841&forum_id=42415


peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top