Results 1 to 2 of 2
  1. #1
    muhfak is offline Member
    Join Date
    Jun 2008
    Rep Power

    Default 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/,

    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("Content-type", "text/xml");
    post.setRequestHeader("Authorization", "Basic HGTFSas);
    post.setRequestHeader("Host", "");
    post.setRequestHeader("Content-Length", "11420");
    post.setRequestHeader("Expect", "100-continue");
    HttpClient client = new HttpClient();
    int result = client.executeMethod(post);
    strXMLResponse = post.getResponseBodyAsString();
    logger.debug("Response from Sure Script: " );
    logger.debug(strXMLResponse );

    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.


  2. #2
    muhfak is offline Member
    Join Date
    Jun 2008
    Rep Power

    Default Got the Solution

    Able to find the solution my self , it is as simple is this:

    BufferedReader brrr = request.getReader();
    String s;
    StringBuffer req_message = new StringBuffer();
    while((s = brrr.readLine()) != null)

    Now req_message will hold all the body content(s).

Similar Threads

  1. Hello Every Body
    By Hassan Hafez in forum Introductions
    Replies: 2
    Last Post: 06-29-2008, 05:40 AM
  2. "Any Body Help, Urgent".
    By adeeb in forum NetBeans
    Replies: 5
    Last Post: 05-28-2008, 12:36 PM
  3. HTML mail body
    By Sudha in forum Java Servlet
    Replies: 0
    Last Post: 03-21-2008, 11:58 PM
  4. Retreiving of mail body using mail number
    By chandu.v09 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-13-2008, 03:25 PM
  5. hi every member here
    By ali obeed in forum Java Applets
    Replies: 0
    Last Post: 03-03-2008, 11:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts