Search code examples
eclipsejsfejbsend

EJB - Send Data to remote


I want to exchange data between two applications JEE6/JSF2.0 and i'm looking for the best solution. I thought of the below solutions :

  • by using a JSON file.
  • by using XML file.
  • by using GSON file.
  • by using Remote interface (EJB 3.0).

For you, what's the best solution to use ?

edit : This two applications will be always running on the same network (but can not be on the same JVM)


Solution

  • I want to provide an alternative to David's answer, as I feel that there are some drawbacks to RMI that he underplayed.

    1. This is a Java specific technology. If a third server needs to be introduced and it is a Microsoft Reporting Services server for example, then it cannot talk in the same language.

    2. RMI is an OLD technology and doesn't particularly look well on a CV. Web services are the future. Experienced RMI developers are more uncommon than experienced web service developers.

    3. Cumbersome and heavy framework

    A better solution in my opinion would be to use SOAP XML based web services. Here are some advantages to this approach:

    1. Universal acceptance in nearly any development framework. No matter the technology, nearly all have helpful libraries for interacting with web services.

    2. Java has good support for object serialization into XML. This means objects can be quickly serialized into a SOAP XML request, sent to the other server, and deserialized back into a Java object by the other application server for processing.

    3. A service layer can give you the decoupling interface between the two applications just as RMI can.

    I hope you reconsider the use of SOAP XML based web services in your application.