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

Call webservice URL through view, on click of a button

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 10, 2011 at 06:49 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 05, 2011 at 12:22 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 06, 2011 at 12:25 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2011 at 10:11 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 23, 2011 at 07:00 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

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

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.