This is a simple java program to read input stream from a source.In the sample described , the source is a URL(google.com).But this source can be modified to read from a servlet/ jsp running in another application as well.
import java.net.*; import java.io.*; public class URLTester { public static void main(String[] args) throws Exception { // specifies the URL to be connected URL myurl= new URL("http://www.google.com"); // URL connection to connect to the URL URLConnection uc = myurl.openConnection(); //Read the input stream from the connection source BufferedReader in = new BufferedReader(new InputStreamReader( uc.getInputStream())); String inputLine; // loop through the input stream and print in the console while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } }