Download data behind proxy

Jul 28, 2011 at 9:07 AM

Hey,

I've downloaded and installed the plugin without any problems.

When i try to download osm data with the OSM plugin, I get the following error:

Messages
Executing: DownloadSymbolizeOSMData "589820,150403967 6598165,64472184 592004,336073998 6600207,74995689" D:\OSMprojects\osmdefdata.gdb\testp "OSM Group Layer"
Start Time: Thu Jul 28 10:03:22 2011
Executing (Download OSM Data): OSMGPDownload http://www.openstreetmap.org "589820,150403967 6598165,64472184 592004,336073998 6600207,74995689" # D:\OSMprojects\osmdefdata.gdb\testp D:\OSMprojects\osmdefdata.gdb\testp\testp_osm_pt D:\OSMprojects\osmdefdata.gdb\testp\testp_osm_ln D:\OSMprojects\osmdefdata.gdb\testp\testp_osm_ply
Start Time: Thu Jul 28 10:03:28 2011
Starting OSM Data download request...
ProxyAuthenticationRequired (407) is not one of the following: OK (200), Created (201), Accepted (202), NonAuthoritativeInformation (203), NoContent (204), ResetContent (205), PartialContent (206)
ProxyAuthenticationRequired
(Download OSM Data) aborted by User.
Failed at Thu Jul 28 10:03:29 2011 (Elapsed Time: 1,00 seconds)
(DownloadSymbolizeOSMData) aborted by User.
Failed at Thu Jul 28 10:03:29 2011 (Elapsed Time: 7,00 seconds)

I've entered my proxyserver credentials in the options window of ArcCatalog.
The regular OSM basemap loads without problems.

Is there any way of supplying the plugin with the right proxy information?

I'm using Arcgis 10, on windows XP SP3 32bit.

Thanks,

Stijn

Coordinator
Jul 28, 2011 at 8:55 PM

Hello Stijn,

I pinged some of the other developers on this... good question on how to pass the proxy info to the tool. Will let you know what I hear, and hopefully soon!

Christine

Jul 29, 2011 at 6:44 AM

Ok, thanks!

Coordinator
Aug 6, 2011 at 12:31 AM

Hello Stijn,

Wanted to give you an update... we need to some further testing with how the tool accesses proxy information. We are going to try to access a proxy test environment on this end.  May not be a quick answer, but we'll keep you posted. Thanks for getting this on our radar!

Christine

Aug 8, 2011 at 6:18 AM

Hi Christine,

No problem!
And thank you for keeping me posted.

Greetz,

Stijn

Nov 17, 2011 at 4:58 AM
Edited Nov 17, 2011 at 5:49 AM

Hi

I've been experimenting with the OSM Download Tool to get through our proxy. This is an initial attempt at getting proxy information to the OSM Download tool which works from inside our proxy. These steps (or some of them) need to be added to the HttpWebRequest code. Note that the additional steps within the try catch are because there are situations where your proxy logon may have changed but the details in ArcCatalog have not been updated to reflect this. If the authentication exception is caught it may be a good idea to update the ArcCatalog proxy details.

  

string testURL = "http://www.openstreetmap.org/api/0.6/map?bbox=-117.32410,33.89612,-117.32147,33.89794";
HttpWebRequest httpClient = WebRequest.Create(testURL) as HttpWebRequest;

 // Get the ArcGIS proxy info. Note that ProxyServerInfo uses the proxy information set in the ArcCatalog options
ESRI.ArcGIS.esriSystem.IProxyServerInfo proxyInfo = new ESRI.ArcGIS.esriSystem.ProxyServerInfoClass();
proxyInfo.ReadProxyServerInfo(); // I'm not sure if this step is necessary as properties seem to be already populated

if (proxyInfo.Enabled) {

    // Proxy authentication is required so set the NetworkCredential on the proxy. This step seems to be required even if the Proxy has credentials already set

    httpClient.Proxy.Credentials = new NetworkCredential(proxyInfo.UserName, proxyInfo.Password);
}

HttpWebResponse httpResponse;
               
try {
      httpResponse = httpClient.GetResponse() as HttpWebResponse;
    }
catch (WebException wex) {
      // If the WebException is a 407 proxy authentication error maybe try again with a username and password prompted from the user
      if (wex.Message.IndexOf("407") > -1) {
              // Get a username and password from the user here maybe with a popup form, create a new web request and try again ....
              httpClient = HttpWebRequest.Create(testURL) as HttpWebRequest;
              httpClient.Proxy.Credentials = new NetworkCredential("username", "password");
              httpResponse = httpClient.GetResponse() as HttpWebResponse;
 }
 // Otherwise throw the WebException as the problem is something else
        else {
             throw wex;
        }
}

// Continue getting the Response Stream if we have got this far
Stream stream = httpResponse.GetResponseStream();

 ........ etc

Hope this might help

 

 

Developer
Nov 19, 2011 at 1:41 AM

I've added code to support dynamic and static proxy configurations. Please do test it in the beta2 release that will be coming shortly and let us know if that fixes the issues.

- Thomas

Coordinator
Nov 22, 2011 at 5:57 PM

Yes, we would appreciate feedback on the version 2.0 beta 2.0 release for the proxy support.  duncanlowes, would you be willing to do a couple of tests for us on this next week (sometime between Nov 28 - Dec 2)? We would like to get the issues worked out before we release a final version; planning to release a beta within the next couple of days.

Christine

Dec 13, 2011 at 11:55 AM

temge, in current change set (72287) there is problem on proxy: Proxy Authentication Required (error 407).

I have seen method AssignProxyandCredentials but here aren't set credential so if I have proxy with authentication I have error 407.

ProxyServerInfoClass (ao) or NetworkCredential("username", "password") or CredentiaCache.defaultCredentials aren't used in this code.

Developer
Dec 14, 2011 at 4:26 AM
Edited Dec 14, 2011 at 4:44 AM

yes, that was my oversight and I essentially changed the code as duncanlowes suggested. I tested it in a simulated proxy environment and it seems to work fine. Please go ahead and test again in your machine environment.