.NET 3.5 includes new abilities to easily leverage web services and Windows Communication Foundation (WCF) services from AJAX enabled web applications. For example, here is a new "ASP.NET Web Service Application" with a single GetMessage() method:
namespace WebServiceAjax
{
[WebService(Namespace = "http://Falafel.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script,
// using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string GetMessage()
{
return "Howdy";
}
}
}
Notice the attribute System.Web.Script.Services.ScriptService that allows the web service to be ...