This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting error 405 Method Not Allowed when calling a @GET webservice using a post method.  RSS feed

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we call a webservice method which uses @GET in another resful service using POST method.

I'm calling the methods in ServiceRestful.java, the method looks like this
 
Saloon Keeper
Posts: 8471
155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So then why are you calling exchange() with HttpMethod.POST?
 
Adi Ishi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did tried like this, I still get the same error

String response = restTemplate.postForObject(paycardIdPath, request, String.class);
return response;
 
Saloon Keeper
Posts: 1752
236
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using a POST request targeted for a handler method which is annotated indicating that it handles GET requests -- 405 Method Not Allowed seems like a proper response.
 
Stephan van Hulst
Saloon Keeper
Posts: 8471
155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it should be possible to forward the request to a GET action, but then pass the GET verb!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!