3 Replies Latest reply on Jul 17, 2008 4:52 AM by Alucard Hellsing

    PHP-Servlet-EJB - design choice?

    Alucard Hellsing Newbie


      I'm looking into implementing an EJB-based service for integration into existing web-site. Website is written on PHP and hosted on standard ISP hosting. There is also a dedicated server which is the base for business logic processing.

      My goal is to implement business logic processing using high-level language with adequate debugging abilities, e.g. Java, employ HTTP-based connectivity and make little change to existing website code.

      Here is design I came up with: there is a PHP class on website-side, which provides business logic methods (i.e. getProductListing(), sendOrder() and such).
      This class translates incoming method calls to HTTP requests on socket, which connects to a servlet on dedicated server. The servlet handles requests with help of EJB and sends back an XML response. XML response received by same PHP wrapper class, processed with XSLT and displayed on web site page.
      Servlet and EJB running under JBoss AS.

      Here go the questions:

      1. Is there anything to be improved in this design?

      2. There is an issue of handling session contexts. Servlet cannot discern users, since from its standpoint, there is only one connection source - PHP wrapper class. So there is need for PHP wrapper to manually supply JSESSIONID cookie from servlet to the browser and back.
      Do you think there is any better way to handle this?

      3. Which is the best way to handle session context on servlet/EJB side? I'm looking at JBoss Seam, but not convinced it will do because of previous issue. I'm looking into manually implementing session context tracking on servlet side, but there probably is a better solution?

      Please let me know your opinion on this design. Feedback is much appreciated.