On 03/11/2009, Jawahar Nayak <[email protected]> wrote:
>
>  Hi,
>
>    I am using the httpclient 3.1. I sent a http request, in response it
>  should return with a status code and with some response. But I did not get
>  any response. And no any exception is thrown.
>
>
>    boolean flag=false;
>    try{
>            statusCode = httpClient.executeMethod(secureHostConfig, method);
>            System.out.println("Status code: " +statusCode);
>            if(statusCode==200){   flag=true;
>            }
>
>        }catch(Exception e){
>              System.out.println("Error while sending http request");
>        }finally{
>              if(!flag){
>                  System.out.println("Operation Failed");
>              }
>        }
>
>  I am always getting "Operation Failed" but I don't see "Error while sending
>  http request".
>  What could be the cause for this problem and how I can resolve it ?

I think you have misunderstood how HTTP requests work. Exceptions are
normally only thrown if there is a low-level communication error,
otherwise the Status Code is set, e.g. to "404" if the page does not
exist.

What is the value of the status code?

>  Thanks
>
>
>  --
>  View this message in context: 
> http://old.nabble.com/An-Issue-while-send-a-request-tp26160038p26160038.html
>  Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [email protected]
>  For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to