ASP.NET WebServices in C#
This demo shows several ASP.NET web services implemented in C#.
Download WebServices.zip. Uncompress this folder into the Demos folder located in the Neokernel directory.
The first sample can be viewed at http://localhost/test.asmx.
Here is the source for the test.asmx page:
<%@ WebService Language="C#" Class="TestWebService.HelloWorldService" %>
using System.Web.Services;
namespace TestWebService
{
public class HelloWorldService: WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
The second sample is also an ASMX page. It can be viewed at http://localhost/math.asmx and it shows a web service that adds two numbers.
Here is the source for the math.asmx page:
<%@ WebService class="MathService" language="C#" %>
using System.Web.Services;
[WebService]
public class MathService
{
[WebMethod]
public double Add(double x, double y)
{
return x+y;
}
}
Updated: 7/8/10 4:23 PM