Creating/Consuming web service for asp.net, HTML
i have a requirement to build some sort of services that can easily be called to a 3dr party API.
the call can be done through simple 1) HTML page 2) ASPX page 3) MOBILE device
i开发者_开发技巧 need help in what is the best way to go forth.
should i create a separate web service project separately and create few methods [WebMethod]
?
also the method can be static?
/// <summary>
/// Summary description for signup_service
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.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 signup_service : System.Web.Services.WebService
{
[WebMethod]
public string CheckZone()
{
return "Hello World";
}
}
The webmethod cannot be static. Here's why: http://weblogs.asp.net/jasonsalas/archive/2004/02/03/66595.aspx
If you need to interact with the service via AJAX request, you'll need to decorate the webservice with [ScriptService] and/or your webmethods with [ScriptMethod]
The web services have no need to be in their own project, but that architectural decision is based on whatever else you have going on.
精彩评论