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

New to Web Dynpro

Hi Everyone: I am attempting to build a first, very simple Web Dypro application that goes beyond the tutorial materials. I have a web service (that I've tested!) that resides on the same Web AS, and I want to display the rows of the table in a Web Dynpro Table object. I have so far:

1) Connected the Controller Context to the Model, and dragged all of the items below the 'response' node of the Web Service to create an tree in the context

2) I connected the View Context to the Controller Context.

Nothing happens when I load the Web Dynpro page. I suspect I need to add some code to the wdDoInit method, but I'm not sure what object I use to invoke the Web Service.

Anyone point me in the right direction to move forward?

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2005 at 04:23 AM

    Hi ,

    If you are new to WebDynpro then make use of the available teamplates in WebDynpro which will take care of generating the required code for intializing as well as executing the webservice.

    1. In the component Controller, create Context using "ServiceController" template.

    Right Click on the componentController and you can select this template.

    This template will generate the code for intialization of the modelnodes and it will generate a method with "executeXXX()" to call the webservice.

    2. In the view, create a button using the "Button Template" and this will call the ".executeXXx()" method in the componentController .

    Check this tooo

    /people/anilkumar.vippagunta2/blog/2005/07/20/developing-web-application-without-writing-single-line-of-code-my-first-web-log

    Regards, Anilkumar

    Message was edited by: Anilkumar Vippagunta

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 29, 2005 at 04:30 AM

    Hi Ian,

    This tutorial might by of help:

    http://help.sap.com/saphelp_nw04/helpdata/en/91/9c2226df76f64fa7783dcaa4534395/content.htm

    To invoke the webservice you can add this in component controller's wdDoInit() method:

    public void wdDoInit() {

    //@@begin wdDoInit()

    // create a new instance of the Web Service ModelClass

    Request_SendEmailPortType_sendEmail req =

    new Request_SendEmailPortType_sendEmail();

    // bind new instance of the Web Service ModelClass to the

    // independent Model Node ¢WebServiceEmail¢

    wdContext.nodeWebServiceEmail().bind(req);

    //@@end

    }

    Imports required:

    ...//@@begin imports

    import com.sap.tc.webdynpro.tutorials.emailws

    .model.Request_SendEmailPortType_sendEmail;

    import com.sap.tc.webdynpro.tutorials.emailws.wdp.IPrivateEmailWSComponent;

    //@@end

    You can then add the following code directly in the wdDoInit() method or in an action handler:

    public void sendEmail() {

    //@@begin onActionSendEmail(ServerEvent)

    IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();

    try {

    // call Email Web Service and update dependent model node ¢Response¢

    wdContext.currentWebServiceEmailElement().modelObject().execute();

    wdContext.nodeResponse().invalidate();

    ...

    } catch(Exception ex) {

    msgMgr.reportException(ex.getLocalizedMessage(),true);

    }

    //@@end

    }

    Bind the Context elements in the view controller to the Table uielement in the View.

    You should be able to retrieve teh table returns by the Web Service.

    Regards,

    Sangeeta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2005 at 04:47 AM

    Hi lan,

    First of all, you need to bind your component controller context to model.

    Map only request model into controller. No need to map response model.

    You will get response under request model, when you execute this model.

    Then write following code in controller's wdinit method to initialize your model.

    ipublic<controller name>.i<model name> model = new <model name>();

    wdcontext.node<model node>().bind(model);

    If this web service requires some input parameters then set those parameters here as follows.

    model.set<parameter>(<value>);

    Now, when you execute your webservice write following code.

    wdcontext.current<model>element().modelobject().execute();

    wdcontext.node<response node>().invalidate();

    Regards,

    Bhavik

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi McCallum,

      I guess you have mapped Response_SEManagerServiceViDocument_viewAllSEs node instead of Request_SEManagerServiceViDocument_viewAllSEs.

      You need to map Request_SEManagerServiceViDocument_viewAllSEs node and execute this node. Under this node you will get response node. This response node will contain result data.

      No need to use Response_SEManagerServiceViDocument_viewAllSEs node.

      Regards,

      Bhavik

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2005 at 05:59 PM

    Have you created a view with a Table UI element?

    Have you bound the table properties (dataSource etc.) to the view context?

    Have you embedded the view in a window?

    You can either call your web service in the component controller's wdDoInit() method or provide some action trigger (e.g. a button) and call it from the buttons action handler.

    Armin

    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.