hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: download csv file
Date Tue, 22 May 2007 19:52:50 GMT
Hi Lani,

> I need to receive information from a web service.  The web server 
> requires https post parameters via an ASP call. (no problem here) then a 

> file is generated and past back.  In a web browser the ASP page returns 
> a csv text file to be downloaded.  How do I catch this file with 
> httpclient?

Use HttpMethod.getResponseBodyAsStream():
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpMethod.html#getResponseBodyAsStream()

Read the data as it comes, convert to characters in the appropriate
character set (or save it to a file as binary). It's plain Java IO,
nothing special about it.

> Where can I learn more about this?

The tutorial is not exactly shining in this point:
http://jakarta.apache.org/commons/httpclient/tutorial.html

Note that if it's a real web service with XML input
and output, you'll receive some multipart mime stuff
as the response and will have to split that by some
other means. In that case, you should consider to
use some web service implementation.

hope that helps,
  Roland

Mime
View raw message