<%@ WebService Language="C#" class=MyMath %> using System; using System.Web.Services; public class MyMath { [WebMethod] public int add(int a, int b) { return a + b; } [WebMethod] public int subtract(int a, int b) { return a - b; } } A simple test page: Enter first Value Enter Second value Call Add Web Method