Post messaging using HTTPClient

R

Renu

Hi,
I'm able to post message on a server using HTTPClient. Server receives
the XML request and sends the XML response, I'm able to receive the
response which is in the form of header, body What i want is to
extract the body of the XML response so that i can parse the XML
response using DOMParser. I tried almost all the API's of HTTPClient
but am unable to extract the Body(eg: getResponseBody etc). If anyone
knows how to go bout it do let me know asap.

Thanx and Regards,
Renu
 
B

biro

Hi,
I'm able to post message on a server using HTTPClient. Server receives
the XML request and sends the XML response, I'm able to receive the
response which is in the form of header, body What i want is to
extract the body of the XML response so that i can parse the XML
response using DOMParser. I tried almost all the API's of HTTPClient
but am unable to extract the Body(eg: getResponseBody etc). If anyone
knows how to go bout it do let me know asap.

Do you mean the response is sent as a HTTP response but its formatted XML
after the headers? You could get the entire response, and dump the headers
by looking for the first blank line - that signifies the end of the headers.
 
W

William Brogden

Renu said:
Hi,
I'm able to post message on a server using HTTPClient. Server receives
the XML request and sends the XML response, I'm able to receive the
response which is in the form of header, body What i want is to
extract the body of the XML response so that i can parse the XML
response using DOMParser. I tried almost all the API's of HTTPClient
but am unable to extract the Body(eg: getResponseBody etc). If anyone
knows how to go bout it do let me know asap.

You should be able to use the getResponseBodyAsStream or
getResponseBodyAsString methods - they are in the HttpMethod
class, not the HttpClient class.

WBB
 
R

Renu

I have tried both the methods getResponseBodyAsStream and
getResponseBodyAsString of HTTPMethod, it returns the header as well
as the body. I want to extract the body part which i'm not able to do
using the API's.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top