How to interact with a Live java process from php?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sophia

    How to interact with a Live java process from php?

    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

  • G.E.M.P

    #2
    Re: How to interact with a Live java process from php?

    Sophia wrote:[color=blue]
    > 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
    >[/color]

    Your details are vague, so it's hard to answer your question.
    I'll guess the "live 24/7" backend java process is a "java servlet"
    running inside a jakarta-tomcat servlet server.

    A jakarta servlet server is essentially a webserver, written in
    the java programming language, that responds to the http protocol
    (processes post and get requests) and usually, but not always,
    runs on port 80.

    To send get parameters to the doGet() function of the servlet,
    you might use a url like:


    Or, in your html page (which might be generated by php code on some
    other server) you might have a form whose action handler makes a post
    to the servlet, with
    <form action="http://yourdomain:8080/servletname" method="post">
    <input type="text" name="xyz">
    <input type="submit">
    </form>

    .......in other words, interacting with a servlet is hardly any
    different than interacting with an apache webserver.
    The servlet that processes the posts and gets, in your case,
    sounds like it is already written. You only need to write the
    html that interacts with the servlet (or write the php that makes the html)

    Servlets written in java a better suited to large complex programming
    logic than php......in the minds of most java programmers anyway.
    That last statement will probably generate some static on this group.
    I work in both languages. And I do think there is a complexity threshold
    beyond which java wins, below which php wins.

    Comment

    • Sophia

      #3
      Re: How to interact with a Live java process from php?

      Thanks for your reply.
      Sorry I was not very clear, what I meant as a 24/7 live process is a
      spearate standalone java program, it needs to be running 24/7 to handle
      task A(backend data processing) and task B (web user request), and both
      tasks need to be handled by the same process ( for resources
      conflicting reason). So in this scenario, java servelet won't
      work(because it is managed by webserver). My current solution is to
      have the php script communicate with the java program via unix sockets,
      afterall, my problem is the classic inter-process communication.

      Comment

      • Sophia

        #4
        Re: How to interact with a Live java process from php?

        Thanks for your reply.
        Sorry I was not very clear, what I meant as a 24/7 live process is a
        spearate standalone java program, it needs to be running 24/7 to handle
        task A(backend data processing) and task B (web user request), and both
        tasks need to be handled by the same process ( for resources
        conflicting reason). So in this scenario, java servelet won't
        work(because it is managed by webserver). My current solution is to
        have the php script communicate with the java program via unix sockets,
        afterall, my problem is the classic inter-process communication.

        Comment

        • Sophia

          #5
          Re: How to interact with a Live java process from php?

          Thanks for your reply.
          Sorry I was not very clear, what I meant as a 24/7 live process is a
          spearate standalone java program, it needs to be running 24/7 to handle
          task A(backend data processing) and task B (web user request), and both
          tasks need to be handled by the same process ( for resources
          conflicting reason). So in this scenario, java servelet won't
          work(because it is managed by webserver). My current solution is to
          have the php script communicate with the java program via unix sockets,
          afterall, my problem is the classic inter-process communication.

          Comment

          • Jim Michaels

            #6
            Re: How to interact with a Live java process from php?


            "Sophia" <quncao@gmail.c om> wrote in message
            news:1137786320 .596371.171820@ o13g2000cwo.goo glegroups.com.. .[color=blue]
            > Thanks for your reply.
            > Sorry I was not very clear, what I meant as a 24/7 live process is a
            > spearate standalone java program, it needs to be running 24/7 to handle
            > task A(backend data processing) and task B (web user request), and both
            > tasks need to be handled by the same process ( for resources
            > conflicting reason). So in this scenario, java servelet won't
            > work(because it is managed by webserver). My current solution is to
            > have the php script communicate with the java program via unix sockets,[/color]

            do you intent to continue to use
            http://us2.php.net/manual/en/ref.sockets.php sockets? PHP has sockets
            functions.
            [color=blue]
            > afterall, my problem is the classic inter-process communication.
            >[/color]


            Comment

            Working...