Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2008, 02:30 PM
Member
 
Join Date: Jun 2008
Posts: 2
muhfak is on a distinguished road
Reading Body Content
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.

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.

Fakhar.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-24-2008, 12:44 PM
Member
 
Join Date: Jun 2008
Posts: 2
muhfak is on a distinguished road
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)
req_message.append(s);

Now req_message will hold all the body content(s).
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-26-2008, 10:19 PM
Member
 
Join Date: Jun 2008
Posts: 12
weiwei is on a distinguished road
新加的空白文章1
这是新加的空白文章1,可以在UBB可视化编辑器中,添加和修改文章内容。
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT +3. The time now is 01:02 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org