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?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.