我有一個Java休息的WebService URL http://localhost:8080/WebServiceEx/rest/hello/dgdg
如何調用Java休息WebService的一個Servlet內
當我執行的URL,WebService的方法返回一個字符串
我的要求是調用內部的上述WebService的URL一個Servlet,任何一個幫助?
ServletCode:
public Class StoreServlet extends HttpServlet{
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException, ServletException {
//Invoke WebService and Get Response String Here
}
WebService的代碼:
public class HelloWorldService {
@Context
private ServletContext context;
@GET
@Path("/{param}")
public Response getMsg(@PathParam("param") String msg) {
return Response.status(200).entity(msg).build();
}
}