Skip to Content
author's profile photo Former Member
Former Member

Problems with Web Dynpro EJB Models

Hi Experts,

I am having problems with Web Dynpro EJB Models when created from CAF Application Services. I have created a CAF entity service, called 'Customer', and a CAF application service, called 'CustomerApp'. When creating the EJB model in my Web Dynpro DC, on the screen where I am supposed to select the 'Enterprise Beans and interfaces', I have duplicates of both the Customer bean and CustomerApp bean. Another problem is that the Customer bean has two methods named 'lock' and two methods named 'unlock' (which I did not create). I can only create the model if I go and manually unselect one 'lock' and one 'unlock' method.

Also, I'm unable to get my model to work in my Web Dynpro application. I followed the tutorial on EJB3" target="_blank">http://help.sap.com/saphelp_nwce10/helpdata/en/45/f7f744aea471fae10000000a1553f6/frameset.htm">EJB3 Web Dynpro Integration, however, I'm unsure of how to access individual elements when your service returns a collection instead of a single entity? Also, what if your service requires input parameters? Whenever I try and add them directly to the modelObject I receive a nullpointer exception.

In 7.0 we could call and assign Application Services to Model objects directly in the code. Is this still possible or do all service calls need to occur through a model node in the web dynpro context?

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Nov 29, 2007 at 09:02 AM

    Hi there,

    Having each bean listed twise is a known issue which will be fixed in the next version. However, you can select any of them and then it works fine.

    Each business object (BO) in CAF comes with some methods directly from CAF. Such are lock() and unlock(). It makes sense not to select them if you do no plan to use them.

    Regarding the collections support - there are no major limitations there, so I would expect that it works fine. Accessing the elements coming from a collection is pure Web Dynpro specific (means does not differ for different CMI models). The most typical example would be to bound the Response model class to a Table WD component.

    You do not need to add any elements manually. Two steps are needed in order to have your Request model objects (which are bound to the WD context) automatically created:

    - register a model instance in WD Runtime during wdDoInit() method

    - make all the Request model classes mandatory for the context (i.e. set Collection Cardinality 1..1).

    Both steps are well described in the documentation.

    com.sap.tc.cm.ejb.example.model.MyStudsModel myModel = 
        new com.sap.tc.cm.ejb.example.model.MyStudsModel();
    wdComponentAPI.getModelInstanceMap().putDefaultInstance
        ("com.sap.tc.cm.ejb.example.model.MyStudsModel", myModel); 

    Consuming CAF services (or pure EJBs) through the EJB CMI Model is much easier and intuitive. Besides it really reduces the manual coding. So keep on digging, I'm sure you'll be pleased with the final result.

    What is the version of the engine you use?

    EJB CMI Model in the version uploaded on SDN does not have CAF support officially. It was intended for consuming EJBs in Web Dynpro applications. Since CAF services are actually EJBs, it is possible to import them via EJB CMI Model. There are some limitations though - at least modifiedAt and createdAt BO properties are not supported as well as some other CAF-specific types. In the next version planned to be released in few months, full CAF support will be provided.

    In order to continue investigations, please post the signatures of the EJB methods you want to consume in Web Dynpro.

    Hope this helps.

    Best regards,

    Vesselin

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.