cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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&override...

Regards

Suresh

Former Member
0 Kudos

Perfect....Thanks Suresh, it solved my problem...

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

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

Former Member
0 Kudos

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