webtier@glassfish.java.net

Reading Body Content

From: <webtier_at_javadesktop.org>
Date: Mon, 23 Jun 2008 04:01:12 PDT

Hi,

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("Content-type", "text/xml");
        post.setRequestHeader("Authorization", "Basic HGTFSas);
        post.setRequestHeader("Host", "xxx.xx.x.xxx");
        post.setRequestHeader("Content-Length", "11420");
        post.setRequestHeader("Expect", "100-continue");
        post.setRequestBody(msgXml);
        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.

Many thanks in advance.

Fakhar.
[Message sent by forum member 'muhfak' (muhfak)]

http://forums.java.net/jive/thread.jspa?messageID=281926