There are numbers of out of the box web services present in SharePoint that will do most of the 

common tasks like methods for working with list ,sites and sub sites, users and groups etc. For
using these web services you need to add the reference of the web service . But if your
requirement doesn’t fit with any of the web methods like parameters of the method or functionality
of the method then you need to create a custom web service.

Below are the steps how you can create a custom web service.

Step: 1

Create an web service project in the visual studio. Name the project as TestServiceProject and rename the Service1.asmx file to TestWebService.asmx.

This .asmx file will contain the web methods and the programming logic. Now we 
can go to the TestWebService.asmx.cs page and define a web method. 

Let’s say i want to create a web method which will do some operations on the list


Step: 2

In Solution Explorer, right-click TestWebService.asmx and select View Markup.
You will see the following line: 

Change this to:

Step: 3

Now create a strong key name for the class library project and compile the project 

Step: 4

Now host this application in your IIS. Now we need to generate the .disco and the .wsdl files.

To generate the .disco and .wsdl file we need to run the disco.exe command.
The disco.exe file will be present at the path “C:\Program Files\Microsoft SDKs

Now open the command prompt and run the disco command as:

C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin > disco http://localhost:5050

Step: 5

Now open both the TestWebService.disco and TestWebService.wsdl file which will
be present at “C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin” and replace the XML processing instruction

“<?xml version=”1.0″ encoding=”utf-8″?>”


Step: 6

In TestWebService.disco file modify the contactref and the soap address tags to:

Step: 7

In TestWebService.wsdl file modify the soap:address and soap12:address to:

Now save the two files as TestWebServicedisco.aspx and TestWebServicewsdl.aspx. 

Step: 8

Now copy the files TestWebService.asmx, TestWebServicedisco.aspx and TestWebServicewsdl.aspx to the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI” folder

Step: 9

To include the Web service in the list of web services on the server, open the spdisco.aspx file which is present at “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI” and add the following within the discovery element.

Now save the two files as TestWebServicedisco.aspx and TestWebServicewsdl.aspx.

Step: 10

Now deploy the TestServiceProject.dll to GAC and the bin directory of the site on which you want to use the web service. Now you can consume the web service like the out of the box web service provided by SharePoint.