I have a simple WS that is a @PUT
and takes in an object
@Path("test")
public class Test {
@PUT
@Path("{nid}"}
@Consumes("application/xml")
@Produces({"application/xml", "application/json"})
public WolResponse callWol(@PathParam("nid") WolRequest nid) {
WolResponse response = new WolResponse();
response.setResult(result);
response.setMessage(nid.getId());
return response;
}
and my client side code is...
WebResource wr = client.resource(myurl);
WolResponse resp = wr.accept("application/xml").put(WolResponse.class, wolRequest);
I am trying to pass an instance of WolRequest
into the @PUT
Webservice. I am constantly getting 405 errors trying to do this..
How can I pass an object from the client to the server via Jersey ? Do I use a query param or the request ?
Both my POJOs (WolRequest
and WolResponse
) have the XMlRootElement
tag defined so i can produce and consume xml..
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…