EJB design: Use EJB client to communicate between 2 systems
I have 2 systems A and B located in separate machine.
- Posted by: Matt Louden
- Posted on: May 14 2004 22:25 EDT
A will pass an XML Request String to B, and B will return
an XML Response string to A.
My friend told me to write an EJB client sitting between
A and B, maybe there is a method called process() in EJB Client.
A can call XML_Response = EJB.process(XML_Request);
XML_Response = B.process(XML_Request)
My question is why EJB client? My understanding is EJB client
will use EJB Beans. Any ideas?? Because A and B
are in separated machine and requires remote procedure call
mechanism for remote communications?
My question is why EJB client? My understanding is EJB client will use EJB Beans. Any ideas?? Because A and Bare in separated machine and requires remote procedure call mechanism for remote communications?If A and B are on different machines, you will need some sort of remote communication protocol between the two.
EJB is not the only option, though. Since you are passing text data, there are lots of choices. You could also use Web Services, a Servlet (send XML dat in a POST request, get the response), JMS or even the old stand-by, RMI.
If I want to stick in EJB client solution, how should i get started? Because I an new to EJB. I thought EJB client needs to communicate with EJB beans here? So I need to write EJB beans too? Please advise more...
You need at least two components: the EJB (running on the server) and an EJB client. The EJB client calls the EJB.
You will also need an EJB server to host the EJB. There are a number of popular servers, some free (JBoss, Sun J2EE Server) and some not (Weblogic, Websphere).
EJBs are a big, complicated subject. It could take a week of study for you to figure out how to handle even a simple client-server interaction like the one you describe.
If you really want to go this route, I suggest you look at Sun's J2EE tutorial, which talks about EJB as well as some of the other alternatives I mentions (servlets, web services).