Reading Body Content
I am bit of a bother here, hope some one might be able to help.
I have a struts application, in which I am being hit at a particular action url say (https: // localhost/apolloweb/billing/sureScriptIncommingMessage.do),
Now at this action I want to read the body content, it was supposed to be in xml form but i have no idea how to read the request content.
I also have to send some xml data to a particular url, which I have achieved through this code:
post = new PostMethod(directoryUrlToPost);
post.setRequestHeader("Authorization", "Basic HGTFSas);
HttpClient client = new HttpClient();
int result = client.executeMethod(post);
strXMLResponse = post.getResponseBodyAsString();
logger.debug("Response from Sure Script: " );
I have not tested this code but I think it will work, Now the receiver of this message will be sending the response of this data
Back to me in the same way as I am doing above.
Now could any body help me out how to read out the xml when a certain request hit your server like the above code is.
I have also tried reading from request input stream but there is no data there
I have serached other forums too but to no avail.
Many thanks in advance.
Got the Solution
Able to find the solution my self , it is as simple is this:
BufferedReader brrr = request.getReader();
StringBuffer req_message = new StringBuffer();
while((s = brrr.readLine()) != null)
Now req_message will hold all the body content(s).