Hi Oleg,
Tried with preemptive proxy authentication, still the
same exception.
-
NRR
--- Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
> I think I have another idea. If you use 'Basic'
> authentication scheme on
> the proxy, try using preemptive proxy
> authentication.
>
> Oleg
>
> On Thu, 2003-07-10 at 21:32, Ramanan nr wrote:
> > Hi Mike, Oleg
> >
> > Thanks for the response.
> >
> > Though I have the latest build, I am still getting
> the
> > socket closed exception.
> >
> > I guess I am missing something in the funda.
> >
> > Here is my code:
> >
> >
> >
> > // SET SYS PROP FOR HTTPCLIENT DEBUG
> >
> System.setProperty("org.apache.commons.logging.Log",
> > "org.apache.commons.logging.impl.SimpleLog");
> >
> >
>
System.setProperty("org.apache.commons.logging.simplelog.showdatetime",
> > "true");
> >
> >
>
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire",
> > "debug");
> >
> >
>
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
> > "debug");
> >
> >
> > //the following decleration can be changed to
> > HttpMethodBase
> > aHttpClient = new HttpClient();
> > PostMethod method = new PostMethod(aURL);
> > method.setFollowRedirects(true);
> > method.setStrictMode(false);
> > method.setRequestBody(aRequest);
> > method.setRequestHeader("Content-type",
> > "application/x-www-form-urlencoded");
> >
> >
>
method.setRequestContentLength(PostMethod.CONTENT_LENGTH_AUTO);
> >
> //method.setRequestContentLength(aRequest.length());
> >
> > int aStatusCode = -1;
> > String aResponse = null;
> > try {
> >
> > aHttpClient.getState().setProxyCredentials(
> > null,
> > null,
> > new UsernamePasswordCredentials(ProxyUID,
> > ProxyPwd));
> >
> > HostConfiguration aHConfig = new
> > HostConfiguration();
> > aHConfig.setHost(aHost,aPort,aProtocol);
> > aHConfig.setProxy(aProxyHost, aProxyPort);
> > method.setHostConfiguration(aHConfig);
> >
> > aHttpClient.setConnectionTimeout(10000);
> > //aHttpClient.setTimeout(10000);
> >
> > // BEGIN RETRY CODE
> >
> > int attempt = 0;
> > Exception retriedException = null;
> > // We will retry up to 3 times.
> > while (aStatusCode == -1 && attempt < 3) {
> > try {
> >
> > attempt++;
> >
> >
>
aHttpClient.getHttpConnectionManager().getConnection(aHConfig).setSoTimeout(10000);
> >
> > aStatusCode =
> aHttpClient.executeMethod(method);
> >
> > //if successful come off the loop
> >
> > } catch (HttpRecoverableException e) {
> > retriedException = e;
> > if (log.isDebugEnabled()) {
> > log.debug("A recoverable exception
> > occurred,
> > retrying.", e);
> > log.debug("Status code from
> > executMethod = "
> +
> > aStatusCode);
> > }
> >
> > } catch (HttpException he) {
> >
> > //throw something
> >
> > } catch (IOException e) {
> >
> > //throw something
> >
> >
> > }
> > }//end while
> > // Check that we didn't run out of retries.
> > if (aStatusCode == -1) {
> > log.debug("Failed to recover from
> exception.");
> > //throw something
> > }
> >
> > // Check that we didn't get a status other than
> OK
> > (200).
> > if (aStatusCode != HttpStatus.SC_OK) {
> > log.debug("Bad status code from executMethod =
> " +
> > aStatusCode);
> > //throw something
> > }
> >
> >
> >
> > //Get a handle to the input stream returned by
> the
> > server.
> > //BufferedInputStream rspStream = new
> > BufferedInputStream(
> method.getResponseBodyAsStream()
> > );
> >
> > String strResponse = null;
> >
> > StringBuffer strBuffer = new StringBuffer();
> >
> > BufferedReader reader = null;
> >
> > try {
> >
> > //Get a handle to the input stream returned by
> the
> > server.
> > InputStream inStream =
> > aMethod.getResponseBodyAsStream();
> > reader = new BufferedReader(new
> > InputStreamReader(inStream));
> > String line = null;
> > int letter = 0;
> > while ((letter = reader.read()) != -1)
> > strBuffer.append((char) letter);
> > inStream.close();
> > } catch (Exception e) {
> > //create exception
> > } finally {
> > if (exceptionToThrow != null) {
> > //throw exception
> > }
> > } //end finally
> > return strBuffer.toString();
> >
> >
> >
> > The request I send to the Postmethod is an XML
> > request.
> >
> > the url is : https://....
> >
> >
> > I tried the same code with http and it works fine
> (as
> > expected I am getting a 404 from the server).
> >
> >
> > any light.. will be helpful.
> >
> > -
> > NRR
> >
> >
> >
> >
> > --- Michael Becke <[EMAIL PROTECTED]> wrote:
> > > The patch for 20938 should have been included in
> > > beta 2.
> > >
> > > Mike
> > >
> > > Oleg Kalnichevski wrote:
> > > > I am a bit doubtful that the bug fix #20938
> had
> > > anything to do with your
> > > > problem. Anyway, it can get the most recent
> > > nightly build at the
>
=== message truncated ===
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]