Are you trying this from your web browser? You won't be able to call POST methods that way.
You can either use curl from your command line or an interactive client such as Postman.
سؤال
I have a web service with 3 endpoints. as follows -
GET /Game/getGameAll/ (com.service.rest.Game)
GET /Game/getGameById/{gameId} (com.service.rest.Game)
POST /Game/updateGame/{gameId}/{isAvailable} (com.service.rest.Game)
For testing I use -
localhost:8080/Game/getGameAll/
localhost:8080/Game/getGameById/1000
and it works perfectly fine.
but when executing update functionality -
localhost:8080/Game/updateGame/1000/true
it gives me an error 404: method not found.
But if i change the annotation from post to get. It executes.
//@POST : If this is changed to Get, it works! But not with @POST.
@GET
@Path(value = "/updateGame/{gameId}/{isAvailable}")
@Produces(MediaType.APPLICATION_JSON)
public Game updateGame(
@PathParam(value = "gameId") Integer gameId,
@PathParam(value = "isAvailable") int isAvailable) { ..
.
}
How can i execute the Post method of a webservice?