Discussions

EJB design: Access EJB from remote clients w/o using browser

  1. Access EJB from remote clients w/o using browser (2 messages)

    Hi,
    We have a requirement wherein the clients are not browser based. These clients need to access EJBs'.
    I would like to know what would be the best way to acheive this.

    Some constraints-
    a) The remote clients cannot be allowed to do lookup, for security reasons (I would also like to know how much of a security risk it is, exposing lookups to external clients).
    b) The EJBs may be spread across multiple sites, different URLs.

    We've have thought out of a couple of solutions-
    a)Using URLConnection to connect to a servlet which would do lookups on behalf of the client,do any processing involved and pass the return values back to the client.
    b)Using dynamic loading in rmi to load all the stubs required,at run time. But this could lead to situations when a large number of stubs may have to be downloaded for the client to invoke a bean. Thus slowing down.

    Can someone suggest a better alternative?

    Thanks...Ram Cherote
  2. hi,
      I guess the servlet way of doing it would be best way to
    do it.I also do not understand as to why the client is
    not allowed to look up.What is the issue that is a concern
    when client makes a look up.would u elaborate
  3. I would suggest, instead of servlets, you can use sockets to connect to a known server ip addr/port, which will to the lookups and then get the EJBHome as data object based on your lookup, and work with it. With the servlet, you will be opening a HTTP connection, and how do you plan to send the objects back?

    Are you planning to make it a message based system in that case? I would suggest, even with message based system, it is better to work with sockets instead of servlets. You can get better granularity of control and security.
    - Sudheer