How to do Web Service Request Forwarding from an HttpServlet
Issue
- An HttpServlet is in front of a Webservice that does some stuff and subsequently forwards the request to the Webservice.
protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
...
String pathInfo = request.getPathInfo();
ServletContext context = this.getServletContext().getContext("/context");
RequestDispatcher dispatcher = context.getRequestDispatcher("/context/path/Webservice?wsdl");
dispatcher.forward(request, response);
-
The relative URL context of the Servlet is different to the Webservice.
-
When forwarding the request an error is thrown "HTTP Status 404 - /context/path/Webservice ... The requested resource (/context/path/Webservice) is not available.
Environment
- Redhat JBoss Enterprise Application Platform (EAP)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.