I am working on websphere with 2 application servers - one for web and one for engine.
I have a
servlet running on engine which recieves the type of input and returns the
string as response in PrintWriter.
In web module Inside a servlet I need to call the servlet of engine - pass the input and get the response.
I know request.sendRedirect will help me but this redirects the page to the engine.
Could you please suggest me a way by which i can pass input from my web servlet to engine servlet and get the response from engine servlet to web.
I have tried writing
url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("POST");
conn.setUseCaches(false);
conn.setDoInput(true);
conn.setDoOutput(true);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
out.write("Type="+adoType);
out.flush();
out.close();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String response;
StringBuffer sb = new StringBuffer();
while( (response = in.readLine()) != null){
System.out.println("Response " + response);
sb.append(response);
sb.append("\n");
}
in.close();
but this doesnt help me.
Please suggest.