Open Visual Studio create new web site. File > New >Website
Add an item as Web Service to the project. Webservice.asmx
Now create some web methods
[WebMethod]
public string GetbyId(string name){}
if the response is in Custom Created Class then return that class object as below
[WebMethod]
[System.Xml.Serialization.XmlInclude(typeof(Students))]
public string GetAll(string name){}
Public Class Student
{
public string name{get; set;}
public string rollnumber{get; set;}
}
Step 2: Publishing the Web Service
To publish the web service the procedure is same as publishing the website because as we created the Web Service under Web Site Project.
No comments:
Post a Comment