I've got a weird problem in Microsoft.AspNet.WebApi{5.2.3}. The following two functions work fine alone, and they even work fine together, when my client is a .NET 4.6 HttpWebClient. However, as soon as a Java application tries to access the function, I get the following message:
HttpResponseProxy{HTTP/1.1 405 Method Not Allowed [Allow: GET,
Content-Length: 73, Content-Type: application/json; charset=utf-8,
Server: Microsoft-IIS/8.0, X-Powered-By: ASP.NET, Set-Cookie:
ARRAffinity=2cc8b96e3a4c1d6ee6a6e0;Path=/;Domain=mydomain.com, Date: Mon, 01
Feb 2016 13:44:57 GMT] ResponseEntityProxy{[Content-Type:
application/json; charset=utf-8,Content-Length: 73,Chunked: false]}}
It looks from the error message, that a GET is being tried (or expected?)? I have added the explicit routing attribute as a last resort. I do not use it elsewhere.
Function 1:
[System.Web.Http.HttpPost]
[System.Web.Http.Route("api/Delegate/MigrateMix2User")]
public async Task<HttpResponseMessage> MigrateMix2User([FromBody] MigrateUserModel userInfo)
{...}
Function 2:
[System.Web.Http.HttpPost]
[System.Web.Http.Route("api/Delegate/ChangeUserEmail")]
public async Task<HttpResponseMessage> ChangeUserEmail([FromBody] ChangeEmailModel model)
{...}
Update Http Traces. Content doesn't look like a cause/problem?
Content usage traces: --- .NET 4.5 HttpClient, works fine:
POST http://localhost:1655/api/Delegate/MigrateMix2User HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsI...bE6s
Content-Type: application/json; charset=utf-8
Host: localhost:1655
Content-Length: 231
Expect: 100-continue
Connection: Keep-Alive
{"r_tc_app_client_id":"TN77PENKGu2Nq525c6Za93jbD7PiHzSo","r_email":"hyxx@acx.org","r_password":"dada","r_lang5":"en-EN","r_country2":"US","r_is_cto":"false","my_cto":"xzy","r_plan_id":"planet","addin_plan_id":"tst","addin_qty":2}
--- Java-Appache http Client: throws 405
"POST /api/Delegate/MirgrateMix2User HTTP/1.1[\r][\n]"
"Authorization: Bearer eyJhbGci...dIRiJE[\r][\n]"
"Content-Type: application/json[\r][\n]"
"Accept: application/json[\r][\n]"
"Content-Length: 274[\r][\n]"
"Host: mytargethost.com[\r][\n]"
"Connection: Keep-Alive[\r][\n]"
"User-Agent: Apache-HttpClient/4.3.6 (java 1.5)[\r][\n]"
"Accept-Encoding: gzip,deflate[\r][\n]"
"{"cto":"true","r_tc_app_client_id":"G04o5323zq1fo6hferi4axABdKvyiSCl","r_email":"kunsbe1@mailinator.com","r_password":"2Mh323aXp","r_lang5":"en-US","r_country2":"DE","r_is_cto":"true","r_plan_id":"05260000_LOR.2001","addin_plan_id":"05260000_LOR.2007","addin_qty":815}"
DEBUG [org.apache.http.wire] http-outgoing-2 << "HTTP/1.1 405 Method Not Allowed[\r][\n]"
2016-02-02 12:49:56,914 DEBUG Wire - http-outgoing-2 << "HTTP/1.1 405 Method Not Allowed[\r][\n]"