1 Browser makes an request to Servlet in Sever1 2 Servlet in Server1 will make an HTTP post request to Servlet in server2 with one paramter called reqData which will be an xml format data as follows <emp> <emp-no>10</emp-no> <emp-name>Bond</emp-name> </emp>
3 Now Servlet on server2 will read this data and send back the response in xml format as <response> <response-code>0</response-code> ... ... ... </response>
I am clear till read reqData and generate response Data (3).
but how do I get response data back in servlet on server1 and display the result on browser ?
I guess I need to use some way to call servlet in sever2 other then simply using sendRedirect.
All desirable things in life are either illegal, banned, expensive or married to someone else !!!
2 Servlet in Server1 will make an HTTP post request to Servlet in server2
If you make a POST request to server2 with a HttpURLConnection, you will get the results back in the response. You can read the response headers and get the response body with separate methods. The headers will probably have useful information and the stream representing the body will have the xml. Look at the methods in java.net.URLConnection and HttpURLConnection. Bill