calling ejb from external application

Discussions

EJB design: calling ejb from external application

  1. calling ejb from external application (5 messages)

    I am creating an application which must recieve the request from an different application (legacy, non java). My application is using EJB's for the business processing. I would like to create a interface through which the legacy system can call my ejb. What is the best way do this.
  2. The J2EE platform supports several integration technologies, including
    CORBA, JCA, Web Services, JMS and even JavaMail. It all depends of the system that you are integrating with, and the requirements of the integration.

    What technologies does the legacy app support?
    Do you need to include the legacy app in transactions?
    Do you need to wait for a response?
  3. Hi Mark,

    We have to write a standard interface which may accept some api call from the legacy application. The ejb does not have to communicate with the existing database, but its own database. I am not sure about the transactional requiremnts as of now.

    Thanks
  4. What technology does the legacy app use?

    Possibilities are:

    - find a JMS transport supported by the Legacy app and use MDBs.

    - start a JVM in the legacy app's address space using JNI, and call a proxy from the legacy app which calls the EJBs. (This works with Ingres W4GL, for instance)

    - write a Java server which calls the EJBs. This server will accept requests from the legacy app via one of:
      -- sockets
      -- polling the legacy app's DB
      -- MQSeries, or any other message bus which has APIs for both Java and the legacy app.

    Tom
    tomdavies at optushome dot com.au
  5. You can create an XML interface.

    Your legacy application should send an XML message to your bean's remote method.

    For sending message to ur ejb, you can either go through a servlet or send Synchrnous JMS (As XML as payload) message to your ejb.

    Your servlet should receive the message, find the EJB(based on xml request) from JNDI, and then invoke the proper method on that ejb's remote interface.

    this is the easy solution.

    You may even avoid using any MOM servers.
  6. I think that the use of Web Services or CORBA could simplify the problem at once. You could use JMS also, but will need to code some logic related to synchronization of messages (JMS doesn't guarantee you the sequental order of messages in the queue or sent to the topic), you could use servlets (the most suicidical way - I do not think that presentation layer should be anyhow referenced to legacy connectivity), you could use even 3rd party screen-scrapers... But summarizing all cons and pros you will someday discover that the use of RPC will make your life much more easier.

    Alex.