cancel
Showing results for 
Search instead for 
Did you mean: 

Call webservice URL through view, on click of a button

Former Member
0 Kudos

Hello Gurus,

I have a local development webdynpro project . My requirement is that on click of a submit button, webservice is called and it returns a string which i need to display on the view. I searched a lot but couldnt find the exact step by step process.

While creating the web service model, which one dhould i choose n then after model creation

what code should i write to call webservice.

Regards

nishu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Nishu,

I would suggest to use consume webservice through the AWSmodel exposed by webdynpro. Please follow the followng link

for further details.

http://wiki.sdn.sap.com/wiki/display/WDJava/FAQ-Models-AdaptiveWebService

Thanks

satyajeet

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello All,

Thanks for all your replies. I am able to create model and bind it to my component controller.

But when i write the code to call webservice , i am unable to instanciate the model....

I wrote the following code :

{

testmodel = new Soap(); - (1)

Request_ServiceSoap_insertTicket insert = new Request_ServiceSoap_insertTicket(testmodel); - (2)

insert.setUserId("CCM_RUS");

wdContext.nodeRequest_ServiceSoap_insertTicket().bind(insert);

}

private Soap testmodel;

In Above code , line (1) , 'Soap' is the name of my WebService model, which i made by importaing the wsdl file from my local system. And line (2), i amd getting error :

the constructor Request_ServiceSoap_insertTicket(testmodel) is undefined.

If i remove the 'testmodel' and just write Request_ServiceSoap_insertTicket() , the webservice is not called, since model instantiation is necessary for webservice Models. I am stuck

Please help

Thanks

Nishu

Edited by: nishu_rj on Aug 23, 2011 9:01 AM

former_member40425
Contributor
0 Kudos

Hi Nishu,

Try following code.


Soap testmodel = new Soap(); - (1)

Request_ServiceSoap_insertTicket insert = new Request_ServiceSoap_insertTicket(testmodel); - (2)

insert.setUserId("CCM_RUS"); 

wdContext.nodeRequest_ServiceSoap_insertTicket().bind(insert);
wdContext.nodeRequest_ServiceSoap_insertTicket().execute();

After adding this code, Organize Imports.

I hope it helps.

Former Member
0 Kudos

Hello all,

I made a new model and chose 'import Web Service Model' in my NWDS.

After selecting the service.wsdl file from my local system, when i click finish, i get all webservice java class files inside source -> packages -> <my model package>.

But the problem is i am not able to see anything under 'Models' so how should i connect it to my component controller.

former_member40425
Contributor
0 Kudos

Hi Nishu,

You have to add your model in "used models" by right clicking on "used models" tree structure. After adding to used models it will be available to your component controller.

I hope it Helps.

Regards,

Rohit Makkar

Former Member
0 Kudos

Hi,

Please find following link on how to consume web service in Web Dynpro - http://www.sapgeek.net/2011/01/web-dynpro-java-how-to-consume-web-service/

Please find below link on more Web Dynpro toturials - http://www.sapgeek.net/sap-tutorial/web-dynpro-java-tutorial/

Regards,

Andy

Qualiture
Active Contributor
0 Kudos

Hi,

There are numerous examples on how to consume an adaptive web service through WDJ on SDN, have a look at [this article for instance|http://www.google.com/url?sa=t&source=web&cd=8&ved=0CE0QFjAH&url=http%3A%2F%2Fwww.sdn.sap.com%2Firj%2Fscn%2Findex%3Frid%3D%2Flibrary%2Fuuid%2F900bbf94-a7a8-2910-e298-a651b4706c1e%26overridelayout%3Dtrue&rct=j&q=site%3Asap.com%20adaptive%20web%20service%20example&ei=6N87To_3Ac2YOoqgsNMH&usg=AFQjCNFgvXiflkfYMc7DVe1h7zJLeJ3Z-g&cad=rja].

Best regards,

Robin