Skip to Content
avatar image
Former Member

Need Code to call webservice method from View/Component....

Hi All

- I created a Web service using "Adaptive WebService Model" for a Method say method1() which return String.

- I create Java Web Dynpro Project/Application & created model and embed this model into our component. And then did context mapping between model-component, component-view for request node.

I didn't write full steps, but everything is ok above....

What i need is coding to call Web Service Method from my View or Component.

Pls help me.

Thanks in Advance...

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 10, 2009 at 05:47 AM

    Hi,

    Write the code as follows

    1) in init method

    YourModel model = new YourModel();

    wdContext.nodeRequest().bind(new Request(model));

    2) create method called executeRequest() and writhe the code in the method as follows

    wdContext.currentRequestElement() .modelObject().execute();

    wdContext.nodeResponse().invalidate();

    For more details go through the below link

    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/301ff0bb-74ca-2910-fa99-eae392695aad&overridelayout=true

    Regards

    Suresh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 09, 2009 at 10:23 PM

    Hi,

    Expalination of modelObject()

    In the above link currentMainElement() is the element of your webservice model node. get_details() is the method you need to call in webservice. Pl dont call directly from view.

    Srini

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Srini

      Actually i have a button in my view, what i want is when i click on button, it should call webservice(MEthod) to display string returned by webservice.

      How to handle this.

      Thanks