cancel
Showing results for 
Search instead for 
Did you mean: 

Example for WebDynpro using EJBs

Former Member
0 Kudos

Hi,

is there an example for web dynpro programming using EJBs

for business logic available?

We have moved an existing EJB from another application server to WAS and want to develop a new frontend using web dynpro.

I found the tutorial "Creating a J2EE Based Car Rental Application.pdf", but there i only found an example using JSPs / servlets.

Regards,

Claus.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Look at this thread:

There is a step-by-step guide on how to call an ejb from within a web dynpro application.

Regards

Dov

Former Member
0 Kudos

Hi Claus,

common practice so far is to create a WebService from the EJB and to import the WS into a Web Dynpro project. Of course this does only work, if you have the EJB(s) available at design time also. AFAIK there's no explicit tutorial for direct EJB usage available yet.

In the future it might be possible to define the EJB(s) as Service Entities in the Composite Application Framework (CAF) Designer and use/import these models in(to) Web Dynpro. But so far the CAF designer only exists as internal version.

Hope that helps.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

thanks a lot. I have the EJB at design time and will try to import the created WS into my Web Dynpro project.

Regards,

Claus.

Former Member
0 Kudos

From an architecture viewpoint I don't think it's a good idea to access EJBs from the J2EE presentation tier with SOAP, I'm afraid.

First, I'm assuming you have a local architecture anyway, that is, the presentation tier and the business (EJB) tier are not distributed. Using distributed access for a local architecture introduces considerable performance overhead. Using XML encoding introduces even more overhead.

Second, using web services technologies for access between J2EE tiers, you lose transportation of for example security and transaction contexts etc between the presentation tier and the business tier.

Rather, you should get access to your EJBs (it might be valuable to consider the session facade pattern btw) via JNDI. I don't know if WebDynpro allows for accessing the JNDI namespace, but as a workaround, you could do so from within a Servlet/JSP for example (workaround only !).

You might have the situation that exposing EJBs as web services makes sense to you anyway though, but then you are likely to have a distributed architecture and/or different client technologies accessing the business tier. Still, for a J2EE client accessing the EJB tier, I'd chose RMI/IIOP over SOAP/HTTP.

Matthias

Former Member
0 Kudos

Hi Matthias,

i agree to your statements. My suggestion using a Web Service for EJB access was driven by the fact that this is the easiest way upto now to create a Web Dynpro model from the service (regardless whether if it's an entity or the session facade of some more coarse grained business logic).

It's possible to access the JNDI namespace (doing remote and local lookups) by Web Dynpro. But at the moment you have to implement the data transfer between the model of the Web Dynpro application data store and the service manually in those cases.

So, using a web service is good enough and helpful for this sample, but of course not always recommended for a productive environment.

Regards

Stefan

Former Member
0 Kudos

I also agree with Matthias. It is unneccessary to use a web service to access an EJB. Could you please show an example of how to call the ejb, pass data to the ejb, retrieve the data from the ejb, and then add that to a model in the web dynpro? This would be very helpful.

Thanks,

Dustin