This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
If you want to invoke EJBs from a Swing application, you can directly do the lookup. For this, when creating the initial context, you need to give the right URL for the server that you are accessing (which you can google to find out).
SCJP 1.4, OCMJEA/SCEA 5.0.
Joined: Sep 13, 2007
The problem of calling EJB in swing is the firewall ,as it communicate using RMI-IIOP and most of the firewall don't allow the communication
If it is a simple type of communication then a simple URL solution would suffice.
If running within the intranet then you can use RMI-IIOP.
If running outside the intranet then I would suggest exposing your session beans as web-services. This should avoid all the firewall issues. However, there are other issues you need to deal with, like session management, etc.
XML-RPC is also a good and simple solution, we use it in our company. However I have not seen this described in any of Sun's material. So, I'll keep away from it, at least for SCEA.
Decide between RMI and web-services. Looking at the conversational state, performance requirements, etc would help you make this decision. I think it's safe to ignore XML-RPC and URL connection.
Joined: Sep 13, 2007
According to me Web-services should be used when the system are heterogeneous but I am not dealing with heterogeneous system as client is also java and server is also java .so I was thinking not to use Web-services.
Java pet store 1.3 version is using simple HttpURLConnection class for server communication so was considering that as one of the option.
"webservices should be used only for heterogeneous systems" ..this is a wrong assumption.... It is not mandatory.. actually it is better if it we use webservices in long run..tomorrow if you want you can change the client say .net etc... i believe nothing can replace webservices
Yes the PetStore does use URL connection, but if you look at the documentation you will find they are using it because the type of communication is very simple. So, if your requirements simple enough then can use URLConnection. Again, how would you manage session, security, transactions, etc. You can also look at REST webservices as an option.