Upgrading a web service from asmx to webAPI

As @Venkat said: "It's not easy to answer directly"; I mean, without considerable amount of manual coding; but making some assumptions I can recommend to implement a controller like:

public class SomeWebServiceNameController : ApiController
{
    SomeObject TheObject = new SomeObject();

    public string GetSomeData(string Param1, string Param2)
    {
        return TheObject.HandleRequest(Param1, Param2);
    }

    public string GetSomeMoreData(string ParamA)
    {
        return TheObject.HandleAnotherRequest(ParamA);
    }

    [HttpPost]
    public string PostSomeMoreData([FromBody]string ParamA)
    {
        return TheObject.HandleAnotherRequest(ParamA);
    }
}

You also should register routes (usually in "WebApiConfig.cs"):

public static void Register(HttpConfiguration config)
{
    config.Routes.MapHttpRoute(
        name: "NumberedParametersAPI",
        routeTemplate: "WebServices/{controller}/{action}/{Param1}/{Param2}"
    );
    config.Routes.MapHttpRoute(
        name: "CharacterizedParametersAPI",
        routeTemplate: "WebServices/{controller}/{action}/{ParamA}",
        defaults: new { ParamA = RouteParameter.Optional }
    );
}

I included the last method "PostSomeMoreData" to be consistent with the client call that you specified in your question (jQuery ajax method call). But keep in mind that primitive parameters in POST method of WebAPI are little bit confusing. Please read these links:

http://www.intstrings.com/ramivemula/articles/testing-asp-net-web-apiget-post-put-delete-using-fiddler/

http://yassershaikh.com/how-to-call-web-api-method-using-jquery-ajax-in-asp-net-mvc-4/

http://encosia.com/using-jquery-to-post-frombody-parameters-to-web-api/


Create a class below, place it under Controllers/Api folder, add the following WebApiConfig under App_Start

public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{action}/{id}",
            new { id = RouteParameter.Optional, action = RouteParameter.Optional });
    }
}

Controller Codee

public class SomeWebServiceNameController : ApiController
{
    SomeObject TheObject = new SomeObject;

    [HttpGet]
    public string GetSomeData(string Param1, string Param2)
    {
         return TheObject.HandleRequest(Param1, Param2);
    }

    [HttpGet]
    public string GetSomeMoreData(string ParamA)
    {
         return TheObject.HandleAnotherRequest(ParamA);
    }
}

Add the following call in global.asax.cs under application_start to register the route:

WebApiConfig.Register(GlobalConfiguration.Configuration);

This is a very simple explanation, and you would probably want to return an object instead of string, but that should do it.