Call an external web service from a servlet

Posted by pAkY88 on Stack Overflow See other posts from Stack Overflow or by pAkY88
Published on 2010-05-17T20:17:20Z Indexed on 2010/05/17 20:20 UTC
Read the original article Hit count: 189

Filed under:
|
|

Hi, I'm developing a servlet that gets a name of a web service and could be forward the request to an external web service, for example: "http://www.webservice.com/..."

I have build a response wrapper that intercept response output but I can't forward request to an external web service, it works only if I redirect the request to a servlet that is on same server.

Example: request.getRequestDispatcher("aMyServlet").forward(request, response) IT WORKS request.getRequestDispatcher("http://www.webservice.com/...").forward(request, response) IT DON'T WORKS because Tomcat search "http://www.webservice.com/..." on the server as a local resource.

How can I do external request?

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets