Oleg,

I am executing the code against a valid url.

I am fine with the 404 error, as I know the target
server will thru a 404 if I request the info using
http. I just tried this to see if there is a problem
with my proxy.

As expected, http goes thru fine. The problem is when
I do a https.

I will look for the proxy log.

btw, though I set the wire log to the debug mode, I
don't see any info. is there any other setting other
than the 
org.apache.commons.logging.simplelog.log.httpclient.wire
=debug 

-
NRR


--- Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
> Wire log would definitely help. Have you tried
> executing your code
> against a valid URL? Besides, you might also want to
> examine proxy &
> target HTTP server logs. It would be very helpful to
> know where exactly
> the connection gets dropped.
> 
> Cheers
> 
> Oleg
> 
> 
> Well, this one should be an easy one. Status code
> 404 is returned in
> case the target URL cannot be found. Please
> double-check your target URL
> 
> > PostMethod method = new PostMethod(aURL);
>                                     ^^^^^^
> 
> 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
> > 
> > 
> 
=== 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]

Reply via email to