I have a controller with two POST methods:
[WebInvoke(Method = "POST", UriTemplate = "/api/controller/action1")]
[ActionName("action1")]
public HttpResponseMessage MethodA(string s1, string s2);
[WebInvoke(Method = "POST", UriTemplate = "/api/controller/action2")]
[ActionName("action2")]
public HttpResponseMessage MethodB(string s1, InternalClass c);
I'm calling it from a test harness. When I try to POST to MethodB using the URL http://localhost/api/controller?s1=<string>, passing c in the body of the POST, the message indicates that it's trying to call MethodA instead (I have a validation filter that indicates "s1 and s2 are required fields").
When I add the action to the URL and try to POST to MethodB using http://localhost/api/controller/action2?s1=<string>, passing c in the body, I get a 404 instead.
I modified my RouteConfig to use these routes:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapHttpRoute(
  name: "Name1",
  routeTemplate: "api/{controller}"
);
routes.MapHttpRoute(
  name: "Name2",
  routeTemplate: "api/{controller}/{id}",
  defaults: null,
  constraints: new { id = @"^\d+$" } // Only integers 
);
routes.MapHttpRoute(
  name: "Name3",
  routeTemplate: "api/{controller}/{action}"
);
routes.MapRoute(
  name: "Default",
  url: "api/{controller}/{action}/{id}",
  defaults: new { controller = "Default", action = "Index", id = UrlParameter.Optional }
);
as was indicated in this question.
What am I doing wrong?
 
     
    