"Connection timed out" with HttpClient.

Hi,
My goal is to consume a web service using Apache AXIS. This web service uses Integrated Windows Authentication.
I use IE have configured Proxy server address and Proxy server port using IE's Tools -> Internet Options -> Connections Tab -> LAN Settings -> Proxy serer.
If type the webservice endpoint address of the form http://239.271.380.120/serveme/WS.asmx in my browser then I see in my browser "You are not authorized to view this page .. HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration. Internet Information Services (IIS)" but there is another client in another network who is getting a login dialog to enter domain\\username and password when he types the web service endpoint address in the browser. This makes me think that either the so called another client is in the same domain as the web service provider and I am not.
Anway, I tried to write standalone HttpClient (I use commons-httpclient-3.0-rc3, commons-codec-1.3, commons-logging-1.0.4) program NTCredentialsClient.java like below :
NTCredentialsClient.java
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.auth.*;
import org.apache.commons.httpclient.methods.*;
public class NTCredentialsClient {
     public static void main(String args[]) {
          HttpClient client = new HttpClient();
          NTCredentials credentials = new NTCredentials("user1", "password1", "MYDESKTOP", "domain1");
          AuthScope authScope = new AuthScope("20.222.335.37", 3128);
          client.getState().setCredentials(authScope, credentials);
          //client.getState().setCredentials(AuthScope.ANY, credentials);
          GetMethod get = new GetMethod("http://239.271.380.120/serveme/WS.asmx");
          get.setDoAuthentication(true);
          try {
               int status = client.executeMethod(get);
               System.out.println(status);
               get.getResponseBodyAsStream();
               // print the status and response
                System.out.println(status + "\n" + get.getResponseBodyAsString());
          catch (Exception e) {
               e.printStackTrace();
          finally {
               get.releaseConnection();
------------------------------------------------------------------In the above program, user1, password1, domain1 are details given by my service provider and
MYDESKTOP is my local machine name from which I am running the above program. 20.222.335.37
is my proxy server address and 3128 is my proxy server port. Now when I run the above
program I get this exception :
Aug 16, 2005 12:43:45 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: I/O exception caught when processing request: Connection timed out: connect
Aug 16, 2005 12:43:46 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: Retrying request
Aug 16, 2005 12:44:11 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: I/O exception caught when processing request: Connection timed out: connect
Aug 16, 2005 12:44:11 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: Retrying request
Aug 16, 2005 12:44:37 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: I/O exception caught when processing request: Connection timed out: connect
Aug 16, 2005 12:44:37 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
INFO: Retrying request
java.net.ConnectException: Connection timed out: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)
        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79)
        at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:704)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:382)
        at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:168)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
        at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
        at NTCredentialsClient.main(NTCredentialsClient.java:28)
------------------------------------------------------------------Can anyone please tell me whether the configurations I have made in my above client program are correct or is there anything that I am overlooking. Also, in the above program for AuthScope constructor, do I need to pass web service server adderss and port OR my local proxy address and local proxy port as constructor arguments ?
Please suggest ...
Thanks & Regards,
Kr.

You will need to define your proxy settings. In java, these are provided as system properties:
System.setProperty("http.proxyHost", "<proxy>");
System.setProperty("http.proxyPort", "<port>");
If your proxy uses HTTP authentication, you will need to define a few more system properties, which I don't know off the top of my head. This should actually get you connected with the web server, but as for the 302 error, you'll probably need to contact the system administrator.
Cheers
Todd.

Similar Messages

  • Get "connect timed out" with twitter4j api

    modified HelloWorldAdapter.java to call " unauthenticatedTwitter.getPublicTimeline();".
    add following code before calling twitter api
    System.setProperty("twitter4j.http.proxyHost", "www-proxy.us.oracle.com"); System.setProperty("twitter4j.http.proxyPort", "80");
    the CEP HelloWorld CEP fails with "connect timed out"
    If I use similar code (testwitter.java) outside CEP. works fine.
    I am using eclipse to test the code.
    --- here is part of the testtwitter.java
    Twitter unauthenticatedTwitter = new TwitterFactory().getInstance();
         System.out.println("Showing public timeline.");
         System.setProperty("twitter4j.http.proxyHost", "www-proxy.us.oracle.com");
         System.setProperty("twitter4j.http.proxyPort", "80");
         try {
         List<Status> statuses = unauthenticatedTwitter.getPublicTimeline();
         for (Status status : statuses) {
         System.out.println(status.getUser().getName() + ":" +
         status.getText());
    --- here is the part of the generateTwitterMessage() at HelloWorld CEP
         Twitter unauthenticatedTwitter = new TwitterFactory().getInstance();
         System.setProperty("twitter4j.http.proxyHost", "www-proxy.us.oracle.com");
         System.setProperty("twitter4j.http.proxyPort", "80");
         System.out.println("---- after seting proxyhost, call generateTwitterMessage");
         System.out.println("---Showing public timeline.");
    try {
         List<Status> statuses = unauthenticatedTwitter.getPublicTimeline();
    for (Status status : statuses) {
         String twitterMsg = status.getUser().getName() + ":" +status.getText();
    System.out.println("msg--"+twitterMsg);
    String message = this.message + dateFormat.format(new Date()) + twitterMsg ;
    HelloWorldEvent event = new HelloWorldEvent();
    event.setMessage(message);
    eventSender.sendInsertEvent(event);
    }catch ....
    Please help me on proxy host/port setup inside CEP

    yatin002 wrote:
    Any ideas/suggestions to solve this issue ???Catch the Exception?
    static boolean checkURL(URL url){
        HttpURLConnection httpCon = null;
        try {
            httpCon = (HttpURLConnection)url.openConnection();
            return httpCon.getResponseCode() == HttpURLConnection.HTTP_OK;
        catch(Exception ex){
            ex.printStackTrace();
            return false;
        finally {
            if( httpCon != null ){
                httpCon.disconnect();
        }

  • HT1222 I am trying to update my phone so I can save my info on my old phone & get a new phone, but I get a error that says "There was a problem with downloading teh software, the network connection timed out.."  HELP!  Not sure what my settings shoud be..

    I am trying to update my phone so I can save my info on my old phone & get a new phone, but I get a error that says "There was a problem with downloading teh software, the network connection timed out.."  HELP!  Not sure what my settings shoud be...
    I never updated anything until now...I want o update my iPhone to the newest version, but i do not want ot loose all that I have on this phone. I was told I needed to update the operating systems so i can put things into the cloud for transport to new phone, but I am just not sure how to do this..Can you help out here??

    Dear Jody..jone5
    Good for you that can't update your iphone because I did it and my iphone dosen't work for example I can't download any app like Wecaht or Twitter..
    Goodluck
    Atousa

  • I am having trouble accessing the iTunes store via iTunes.  It shows an error message "iTunes could not connect to the iTunes Store.  The network connection timed out..." There is nothing wrong with my connection and I also can't update apps in the app st

    I am cannot access the iTunes store via iTunes on my PC and also can not update to 10.6.3.  It keeps telling me that my connection has times out and/or check my settings.  There is nothing wrong with my setting.  I am also having trouble with the app store on my iPhone 4s and can not update apps.
    I have signed out of itunes and now cannot sign in again.

    I feel you pain i'm haveing the same problems here.
    iTunes could not connect to the iTunes Store. The
    network connection timed out.
    Make sure your network settings are correct and your network
    connection is active, then try again.
    does anyone plz have some insight for us.

  • I am having alot of problems with itunes, including a "connection timed out" error CONSTANTLY. Any suggestions?

    My iTunes has always been a huge pain no matter what ive done. It runs slowly in general, freezes up every now and then, and when trying to restore my iPod touch 4g, i need to download a software update, which is impossible, due to the fact that every time i try i get a "Network connection timed out" message. I have also had the issue of my account locking me out twice now in a very short period of time, and i have no idea why. It says for security reasons, but ive changed passwords and everything.
    I would like to know if an update is comming soon to make things smoother, because ive long since lost patience with iTunes.

    If you are getting a network timeout error when downloading an iOS update then try temporarily turning off all your firewall and antivirus software until the download has completed.
    In terms of whether an update is coming, we are just fellow users on here so we won't know when the next update might be, and what might or might not be in it.

  • When trying to connect to Airplay speakers I get error message "The  network connection timed out" although some sort of connection is made as the speaker is turned on.  Same thing with Apple TV.  Is the distance from my speaker/ TV the problem?

    When trying to connect from iTunes to Airplay speakers I get error message “The  network connection timed out” although some sort of connection is made as the speaker is turned on.  Same thing with Apple TV.  Is the distance between my PC and the speaker or the AppleTV the problem?

    Hi whitwick,
    If you are having issues with your network connection when attempting to use AirPlay, you may want to use the steps in this article to troubleshoot -
    iTunes: Troubleshooting AirPlay and AirPlay Mirroring
    http://support.apple.com/kb/TS5209
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • TS1814 "There was a problem downloading the software fot the iphone. The network connection timed out.there's no pblm with my connection but this error keeps on showing,  what to do?

    "There was a problem downloading the software fot the iphone. The network connection timed out."
    there's no pblm with my connection but this error keeps on showing, 
    what to do? please help....

    Stop with the silly and pointless fonts.
    A simple search of the forums for the actual error would have revealed the resolution.
    Temporarily disable all security software on the computer.

  • DeskI Job Server Hangs with Connection timed out error in trace file

    Hi, in these days I have a problem with Desktop Intelligence Job Server. After some hours after its starting (it's restarted every day in the morning to allow db backup) in the trace file I can see errors like this:
    [Wed Apr  8 09:58:40 2009]      28116   1457753008      (../iinfoprocessing_implmixedproc.cpp:607): trace message: Failed to send message to child: 28527, err 0, PipeListener: timed out reading from pipe: Connection timed out
    [Wed Apr  8 09:58:43 2009]      28116   1457753008      (csipipe.cpp:242): trace message: PipeListener: ReadString(1) timed out: Connection timed out
    [Wed Apr  8 09:58:43 2009]      28116   1457753008      (../iinfoprocessing_implmixedproc.cpp:607): trace message: Failed to send message to child: 28529, err 0, PipeListener: timed out reading from pipe: Connection timed out
    [Wed Apr  8 09:58:46 2009]      28116   1457753008      (csipipe.cpp:242): trace message: PipeListener: ReadString(1) timed out: Connection timed out
    [Wed Apr  8 09:58:46 2009]      28116   1457753008      (../iinfoprocessing_implmixedproc.cpp:607): trace message: Failed to send message to child: 28553, err 0, PipeListener: timed out reading from pipe: Connection timed out
    [Wed Apr  8 09:58:49 2009]      28116   1457753008      (csipipe.cpp:242): trace message: PipeListener: ReadString(1) timed out: Connection timed out
    [Wed Apr  8 09:58:49 2009]      28116   1457753008      (../iinfoprocessing_implmixedproc.cpp:607): trace message: Failed to send message to child: 28555, err 0, PipeListener: timed out reading from pipe: Connection timed out
    [Wed Apr  8 09:58:52 2009]      28116   1457753008      (csipipe.cpp:242): trace message: PipeListener: ReadString(1) timed out: Connection timed out
    [Wed Apr  8 09:58:52 2009]      28116   1457753008      (../iinfoprocessing_implmixedproc.cpp:607): trace message: Failed to send message to child: 28591, err 0, PipeListener: timed out reading from pipe: Connection timed out
    All job submitted remains in "Suspend" mode and never pass in "Executing".
    To solve the problem I've to manually stop and restart the DeskIjob server, but after some hours the problem reappear.
    How to solve it?
    I've installed Business Objects XI R2 SP5 on Linux SLES 10
    Thanks

    Checking the jobcd trace of child process in connection timeout, I can see, at the time in which in jobsd process the error occurs, the following error:
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      (../ijob_implmixedproc.cpp:143): trace message: MixedProcMgr: msg = GetLoad
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      (../ijob_implmixedproc.cpp:128): trace message: MixedProcMgr: timed out wating for new jobs, shutting down.
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      (pp_procFC.cpp:3716): trace message: IJobDllUnInitialize
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      (pp_procFC.cpp:951): trace message: ReleaseStaticSubsystem()
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      (pp_procFC.cpp:168): trace message: t_shutdown_ptr::reset()
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      (pp_procFC.cpp:172): trace message: Shutting down INTERFACE
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      trace message: TraceLog: [ENTER] BOLApp::ExitInstance
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      trace message: TraceLog: [ENTER] ~_BOUserUniverseManager
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      trace message: TraceLog: [ENTER] ReleaseUniverseCache
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      trace message: TraceLog: [EXIT]  ReleaseUniverseCache: 0
    [Thu Apr  9 09:14:08 2009]      8940    1452690272      trace message: TraceLog: [EXIT]  ~_BOUserUniverseManager: 0
    The error occurs exaclty 2 hours after the starting of the child ... I don't think it's a coincidence ....
    Edited by: David Loreto on Apr 9, 2009 11:41 AM

  • Im facing problem while trying to update my iphone 4 from version 4.3.1 to iOS 5. While processing the downloaded 774mb file, it comes with the statement that the network connection timed out. why???

    im facing problem while trying to update my iphone 4 from version 4.3.1 to iOS 5. While processing the downloaded 774mb file, it comes with the statement that the network connection timed out. why???

    i have been dealing with this same issue, tried to  turn off firewall and even turn of antivirud but still it gave me the same error.

  • Update to Muse CC 2014.3 still have problem upload to FTP: Server not responding in time, FTP may not be supported on this server [Connection timed out after 15001 millseconds.] I have no problem with CC 2014. Can you suggest what do I have to do?

    Update to Muse CC 2014.3 still have problem upload to FTP: Server not responding in time, FTP may not be supported on this server [Connection timed out after 15001 millseconds.] I have no problem with CC 2014. Can you suggest what do I have to do?

    Hello.
    Today I got the opportunity to work with a Muse user with the same issue after performing the troubleshooting steps in the post above we decided to contact the host.
    Later i came to know that host took Muse user's IP and they were able to unblock it and muse started connecting to FTP host.
    I another scenario Host suggested Muse user to add :21 to the FTP address and then Muse was able to connect.
    Eg    ftp.domain.com:21
    Please try the 2 suggestion above and let me know if it works.
    Regards
    Vivek

  • BIPCatalogUtil extraction always fails with "Connection timed out"

    BIPCatalogUtil extraction always fails with "Connection timed out".
    Any suggestions on what could be the issue?

    One thought was that perhaps it was timing out going out some unused port (e.g., the Airport port), but a list shows only the Ethernet port is enabled:
    admin$ sudo networksetup -listallnetworkservices
    An asterisk (*) denotes that a network service is disabled.
    Built-in Ethernet
    *AirPort
    *Built-in FireWire
    *Bluetooth

  • Everytime I connect to update message comes up saying There was a problem with the downloading The network connection timed out what should I do

    After connecting with itunes phone starts update but then message comes up saying "There was aproblem downloading the software for the iphone The network connection timed out" How do I fix this problem?

    Usual cause of this is security software on your computer: Firewalls & Anti-Virus software. Turn off or disable all of that stuff, try again.

  • When syncing iPhone with iTunes I get an iTunes stopped working and the network connection timed out message. I reinstalled iTunes and checked settings still no go.

    When syncing iPhone with iTunes I get an iTunes stopped working and the network connection timed out message. I reinstalled iTunes and checked settings still no go.

    Disable or turn off your firewall, anti-virus, and all security software and try the download again.
    Stedman

  • I can't sign in with account in my itunes everytime said to me the network connection timed out but i can login in the website .. thanx

    i don't know why i can't sign in with my account in itunes store and everytime it said the network connection timed out .. thanx

    Hi Ishrak,
    I apologize, I'm a bit unclear on exactly what you are trying to log into with your Apple ID, or what exactly you are seeing (alert message, directions, etc) when you try to do so. If you continue to have issues with your Apple ID, you may find one or more of the articles linked from the following page helpful:
    Apple ID - Apple Support
    Regards,
    - Brenden

  • Problem with Ipad2 upgrade connection timed out

    I'm trying to upgrade my ipad2 to ios5. After finishing download, it always said there is a problem due to connection timed out. Could someone help pls?

    Turn off the security and firmware on your computer while you are updating ,that should speed things up.

Maybe you are looking for