Can Session EJB play the Web Service role

Qand Davaatsedev

Ranch Hand

Posts: 36

posted 14 years ago

There is a session bean which makes some complex computations on business data. I am planning to have Java SDK client and Web client using this session bean service. What is the best deployment schema for this case? Is it good idea to deploy the session bean as a separate application on Websphere (my preference)? Or it is better to create J2EE client and deploy WAR, EJB-JAR and client JAR togeter? Thanks.

Qand

Edy Yu

Ranch Hand

Posts: 264

posted 14 years ago

Will your J2EE client talk to the session bean which does the cumputation work?

Yes both java client and web client will. I would prefer to use java sdk client according to the IBM classification: <quote> Pluggable and thin application clients�The Pluggable and thin application clients provide a lightweight Java client programming model, thinner than the one offered by the J2EE application client. The pluggable application client uses the Sun Java Development Kit, and the thin application client uses the IBM Developer Kit For the Java Platform. </quote>

Qand

Edy Yu

Ranch Hand

Posts: 264

posted 14 years ago

Qand, the thin client approach is a legitimate approach. IBM stated a fews times. Therotically, it is possible. But I've never got it worked out perfectly by myself. Neither can I find any deep information on this issue from IBM. Practically, it is tricky. Could you post a message on this forum after you worked it out? [ July 08, 2003: Message edited by: Edy Yu ] [ July 08, 2003: Message edited by: Edy Yu ]

Edy, Actually I have a session bean deployed on Websphere and thin client which communicates with the bean from the IDE(WSAD). Here is a code on the client:java.util.Properties properties = new java.util.Properties(); properties.put(javax.naming.Context.PROVIDER_URL, "iiop://servername:900"); properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");javax.naming.InitialContext initialContext =new javax.naming.InitialContext(properties); Object objRef = initialContext.lookup("calculator"); CalcHome home = (CalcHome) PortableRemoteObject.narrow(objRef,CalcHome.class); Calc calculator = home.create(); result=calculator.compute(); Do you think it is good idea to deploy Calculator as a separate application or it should be part of another application?

Qand

Edy Yu

Ranch Hand

Posts: 264

posted 14 years ago

Qand: Your client is not a thin client. Were you able to run it out of the IDE? Maybe put it on a seperate PC with only JDK loaded? My interpertation of thin client is a regular Java app leveraging RMI/IIOP to talk to your EJB directly. It doesn't depend on any IBM specific packages... I think it is OK to deploy this bean as a seperate app. [ July 09, 2003: Message edited by: Edy Yu ]

Edy, Thank you for your opinion. I believe my app will work on the separate machine although I don't have time to check it right now. The only thing it needs is a jar file that contains all the stubs, which were generated by WSAD for a session bean. I didn't work until I created this jar.