hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Wild <tim.w...@solnetsolutions.co.nz>
Subject HttpClient and streaming xml out
Date Wed, 07 Jul 2004 21:10:34 GMT
Hi all,

We have the need to connect to a server and authenticate using client 
certificates, then stream an xml request out to it. I can do the client 
cert stuff, but can streaming out the xml be done with HttpClient? Our 
current code (without client cert support) is below.

The other method i've tried is just using a plain HttpsUrlConnection, 
but getting it to send the client cert is proving to be tricky. I've 
registered the DefaultSSLSocketFactory, but for some reason it won't 
present my client cert :(

Any thoughts appreciated.

Thanks

Tim

URL urlObj = new URL(url);
HttpURLConnection.setFollowRedirects(true);
HttpURLConnection connection = (HttpURLConnection)urlObj.openConnection();
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setInstanceFollowRedirects(true);
OutputStream os = connection.getOutputStream();
PrintWriter writer = new PrintWriter(os, true);
writer.println(message);
os.close();
InputStream is = connection.getInputStream();
Reader reader = Util.convertInputStreamToReader(is);


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org


Mime
View raw message