Monday, August 23, 2010

How to run webservice in Asp.Net

Steps to Create Webservice:

1.File->New Website->Select Asp.net Webservice->save ur webservice

2.In solution Explorer->App_code->service.vb-><Webmethod>_->write ur Code.

3. Create New Method like <Webmethod>_

         Public function add(a as integer,b as integer) as integer
return (a +b)
end function

4. Press F5 to run ur webservice or Debug ur webservice.

5. Add link button will be display on the output window.copy that URL before clicking Add. click Add that button u have 2 texboxes give ur input and press invoke button. XML output will display.

6. Create a new website application->S.E->Add webreference->paste that URL -> localhost->AddReference->3 files to be generated under the localhost service.

7. Drag and drop the required controls and when u click the Button u write this code;

        dim a,b,c as integer
     Assign ur textbox into a,b like a= textbox1.text and b=textbox2.text
      dim obj as new localhost.service
      c=obj.add(a,b)
      response.write(c)

8.Press F5 to run the web application.

      

No comments:

Post a Comment

Confidence may not bring success but
It gives a heart to face any challange..!