Problem with HTTPClient and getResponseBodyAsString()
Hi,
I'm working on interfacing with a payment portal and at some point I have to submit hashed XML to a servlet (my own). I post and get a successful response, however I do not wish to "capture" the response and output it back, but rather redirect the response (without involving the calling servlet) and put everything in an iFrame.
My Servlet:
Code :
try{
PostMethod post = new PostMethod("https://www.url.com/checkout.aspx");
post.addParameter("params", XMLData);
HttpClient client = new HttpClient();
int status = client.executeMethod(post);
String reply = post.getResponseBodyAsString();
out.print(reply);
} catch (Exception e){
out.print("ERROR ");
e.printStackTrace(out);
}
My HTML:
Code :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
</head>
<body style="text-align:center">
<iframe style="border: 0px;" src="http://localhost:8084/test" width="650" height="540">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
To give you an idea, the response is an html form, that doesn't submit because the service "checkout.asp" is not available on this server, but on the originating server.
Does anyone have an idea on how to sort this? Thanks a bunch