How to interact with a Live java process from php?

Discussion in 'Java' started by Sophia, Jan 20, 2006.

  1. Sophia

    Sophia Guest

    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
    Sophia, Jan 20, 2006
    #1
    1. Advertising

  2. Sophia

    IchBin Guest

    Sophia wrote:
    > 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-)
    IchBin, Jan 20, 2006
    #2
    1. Advertising

  3. Sophia

    Sophia Guest

    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?
    Sophia, Jan 20, 2006
    #3
  4. Sophia

    IchBin Guest

    Sophia wrote:
    > 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-)
    IchBin, Jan 20, 2006
    #4
  5. On 19 Jan 2006 17:13:19 -0800, Sophia wrote:
    > 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

    --
    [ do not email me copies of your followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Jan 20, 2006
    #5
  6. 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
    --
    The most horrifying thing about Unix is that, no matter how many times you hit
    yourself over the head with it, you never quite manage to lose consciousness.
    It just goes on and on. -- Patrick Sobalvarro
    Dimitri Maziuk, Jan 20, 2006
    #6
  7. Sophia

    Sophia Guest

    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.
    Sophia, Jan 20, 2006
    #7
  8. Sophia

    Sophia Guest

    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.
    Sophia, Jan 20, 2006
    #8
  9. Sophia

    Sophia Guest

    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).
    Sophia, Jan 20, 2006
    #9
  10. 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
    --
    Things seemed simpler before we kept computers. -- IX, Revelation
    Dimitri Maziuk, Jan 21, 2006
    #10
  11. Sophia

    peter Guest

    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
    peter, Jan 22, 2006
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Garg
    Replies:
    5
    Views:
    407
  2. beginner
    Replies:
    12
    Views:
    447
    Diez B. Roggisch
    Aug 2, 2007
  3. raviraj joshi
    Replies:
    0
    Views:
    297
    raviraj joshi
    Jul 4, 2009
  4. reshma shinde
    Replies:
    0
    Views:
    384
    reshma shinde
    Jul 4, 2009
  5. Rajive Narain
    Replies:
    0
    Views:
    1,559
    Rajive Narain
    Sep 18, 2009
Loading...

Share This Page