0

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";
        }
    }
1
  • Unless you're stuck using .NET 2.0, you should not use ASMX web services for new development. WCF should be used instead. Commented Mar 2, 2011 at 21:26

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

the reason i wanted to have own project for WS is that, i can call the WS from html or aspx page or mobile...
It's a web service. It can just be an asmx page as part of an existing website, can be a standalone project, or any combination thereof. The only requirement is that it can be reached with HTTP/S.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.