Skip to Content
avatar image
Former Member

WebService Model or JavaBean Model????

Hey Experts,

I am using NW CE 7.1 EHP1 for developing an application.I am using Oracle as a database and webdynpro java as UI. I have three options to develop my business logic:

1) Directly access Oracle from Webdynpro Java using Java Class

2) Write my business logic in stateless session bean and use it as java bean model. I can use EJB3.0 for the same.

3) Use webservice as a model which contains my business logic.

I need your help to identify the best option out of the three aforementioned options and why do you think that option is the best.

I appreciate if anyone can list down pros-cons of above options.

Regards

Abhinav Sharma

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    May 20, 2010 at 10:55 AM

    Hi,

    Well you can combine all the three. Use java classes for your entities to represent the tables. Create interfaces containing your business functions and implement them in the implementation classes. Wrap them inside the stateless session bean, I mean just call the functions from the session bean business method, don't implement the code there.

    Then expose this as webservice and use webservice model to fetch the backend data.

    Regards,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Manoj,

      Thanks for the thought. I know I can use any of these methods or combine them. However, my question is what would be the best possible approach and why? If I combine all the options, will it have better perfomance and data management than using them separately?

      Regards

      Abhinav

  • May 21, 2010 at 02:27 AM

    Hi Abhinav,

    I have tried 1st and 2nd option in my previous project but found 2nd option much better, cos in this way you can seprate your business logic and UI part and wil be able to achieve MVC concept and it is good practice to follow MVC concept.

    Deepak!!!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 21, 2010 at 03:14 AM

    Hi,

    i think webservice is better.

    if you plan to let more other systems read and write Oracle, the webservice can be a template to call and reuse.

    Fisher

    Add comment
    10|10000 characters needed characters exceeded

  • May 21, 2010 at 06:54 AM

    Hi Abhinav,

    The option 1 breaks the MVC concept straighforwardly, so it is not recomended mostly.

    If you are going for option 2, then also there is a problem as explained below...

    If you have created an EJB Module which communicates with your database via a session bean and if you are using DC of type webdynpro as your UI, then you need to add the Enterprise Application DC (which is created to deploy the EJB Module DC) as dependency in WebDynpro DC, because...

    when you create a new model of type Enterprise JavaBean Model in your WebDynpro DC, at that time you have to choose your Enterprise Application DC in the available public parts.

    So it is very much clear that if you want to use the same database table access logic written in "Enterprise Application DC" and "Enterprise Application DC" in multiple WebDynpro DCs then it becomes mandatory to add the Enterprise Application DC as a Dependent DC for all those WebDynpro DCs.

    The option 3 is the best option as you add the methods of your choice defined in EJB to the Session beans local Interface and then Expose the session bean's local interface as a Web Service.

    In this case unlike option 2 there's no dependency on the source code of Enterprise JavaBean or Enterprise Application DC.

    I hope this information will help you choose the best option now.

    Regards,

    Shreyas Pandya

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Shreyas,

      Thanks for your response. I am looking for this kind of reasoning only. It will definitly help me in choosing the best possible way to address the client's requirement.

      Thanks

      Abhinav Sharma