I'm looking into implementing an EJB-based service for integration with 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. This processing is to reside on separate server.
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 maintain session contexts?
3. Which is the best way to handle session context on servlet/EJB side? I'm looking at JBoss Seam, but not sure it will do, because of the item 2 issue. I'm looking into manually implementing session context tracking on servlet side, but may be you advise a better solution?
Please let me know your opinion on these questions. Feedback is much appreciated.