ASP.NET - Explain the steps to create a web services and consume it.

Explain the steps to create a web services and consume it.

Steps to create and consume a webservice

Creation:

1. Create a new website by selecting "ASP.NET Web Site" and giving it a suitable name.
2. service.cs file appears inside the solution with a default webmethod named as "HelloWorld()".
3. Right click on the webservice project and add a web reference instead of adding a normal reference.
4. A window appears that displays a list of webservices knows to the solution.
5. Click on "Webservices in this solution"
6. a search progress bar appears and
7. Select the service that appears in the list
8. Progress bar appears once again.
9. Web method appears on the screen
10. Click on "Add reference" button. This would add localhost
11. Solution would have App_WebReference folder

Consumption or Usage:

1. Add a UI (.aspx) to the webservice project.
2. Add a button and a label to the form.
3. Double click the button to see the click event of the button.
4. Create an object of type service localhost.serviceName.
5. Write code to display the value returned by the webmethod on the label.
6. Execute the solution by setting the added aspx as the startpage.
7. Click on the button and the message "Hello World" would be displayed on the label.
Difference between cache object and application object - ASP.NET
Difference between cache object and application object - Application variable/object stores an Object with a scope of availability...
What is Cache Callback in Cache? - ASP.NET
What is Cache Callback in Cache? - The cache object has dependencies e.g. relationships to the file it stores..
What is Scavenging? - ASP.NET
What is Scavenging? - A process where items are removed from cache in order to free the memory based on their priority...
Post your comment