File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Swing client and J2EE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Swing client and J2EE" Watch "Swing client and J2EE" New topic

Swing client and J2EE

Suresh patel
Ranch Hand

Joined: Sep 13, 2007
Posts: 32

I am bit confused in designing the communication between Swing Client and J2ee, Possible option I am thinking are

Client side
2) Web Services
3) HttpURLConnection
4) RMI (would not prefer this due to firewall issue)

Server side
Going to use Front controller design pattern

Any suggestion are welcome

Thanks in advance
Ranganathan Kaliyur Mannar

Joined: Oct 16, 2003
Posts: 1076

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).

Suresh patel
Ranch Hand

Joined: Sep 13, 2007
Posts: 32
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
mc khan

Joined: Aug 14, 2008
Posts: 19
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.

Good luck!
Suresh patel
Ranch Hand

Joined: Sep 13, 2007
Posts: 32
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.

Still things are not clear....

Any more suggestion are welcome
aleem khan
Ranch Hand

Joined: Aug 07, 2008
Posts: 94
"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

SCJP(1.4), SCWCD, Oracle 9i SQL certified, Oracle PLSQL Developer Certified Associate
mc khan

Joined: Aug 14, 2008
Posts: 19
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.
I agree. Here's the link:
subject: Swing client and J2EE
Similar Threads
bad design ?
How to turn off client's console ?
Java Web Start
Regarding J2EE Application deployment