0
votes

I am using spring rest APIs and getting Http 405 error for all the POST methods.

I have following POST method,

@RequestMapping(value = "/GetPlanByBasicContext/", method = RequestMethod.POST)
public @ResponseBody Plan getPlanByBasicContext(@RequestBody BasicPlanContext basicPlanContext) 
{
  return planService.getPlanByBasicContext(basicPlanContext);
}

I am using fiddler to post the following request,

POST http://localhost:8080/now/Plan/GetPlanByBasicContext

{ "sourceLocation":"",  
  "destinationLocation":"", 
  "modeOfTransport":"car"
  "budget":"any"
}

Same attributes are present in BasicPlanContext on the server, along with getters and setters.

I have tried other solutions mentioned and nothing has worked.

Note: Security is not configured for spring yet.

1
please put your murkup too. - Ataur Rahman Munna
I am using fiddler to make the POST request. Not using HTML yet. - varsh

1 Answers

1
votes

you are posting to a wrong URL , you are missing a trailing slash in the end of your URL, try posting to : http:// localhost:8080/now/Plan/GetPlanByBasicContext/