List Map Services - Function Error

1181
7
05-03-2013 04:24 AM
J_B__K_
New Contributor III
Hi!

Using this tool looks so easy (acording to http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ListMapServices/00s30000004s000000/), but it is not working for me 😞 ...

My code:
import arcpy
serviceList = arcpy.mapping.ListMapServices("http://sampleserver1.arcgisonline.com/arcgis/services","sampleserver1.arcgisonline.com")
for serviceName in serviceList:
    print serviceName


And Im still getting "IOError: Object: Connection error ?"... What is wrong? Can someone help, please?

eddit: version ArcGIS 10.0 SP5, Python 2.6.5, target ArcGIS Server 10.0 SP4 (I think)
Tags (2)
0 Kudos
7 Replies
MichaelVolz
Esteemed Contributor
I tried to make a User Connection to the ArcGIS Server in ArcCatalog that you referenced in your post, but it asked for credentials.

Can you try the same thing in ArcCatalog on your machine?

It does not appear you are supplying a username and password in your code.

I did try to connect to this server with my ArcGIS Online credentials, but that did not work.
0 Kudos
J_B__K_
New Contributor III
Yes, it is possible to make a user connection to this AcrGIS Server without any problems, without credentials needed (see the image). It is just a basic, "open", ESRI´s sample server, I have put it into my code just to show the error, just because it is easily accessible...
[ATTACH=CONFIG]23992[/ATTACH]
0 Kudos
MichaelVolz
Esteemed Contributor
When I try to duplicate your internet connection to this server I am prompted with a dialog box that asks for Proxy Credentials.  I can not get past this prompt with either my network credentials or AGOL credentials.
0 Kudos
MichaelVolz
Esteemed Contributor
The below thread shows another user who was unable to use the ListMapServices method in python.  It is interesting how ESRI's response did not show this person the correct syntax to actually get this method to work.  I have also reproduced your error even on an internal server so it seems something is missing from the ESRI documentation.

http://forums.arcgis.com/threads/51961-ListMapServices-and-ExportToPDF-how-to-pull-in-external-layer...

I was finally able to make a user connection to http://sampleserver1.arcgisonline.com/arcgis/services from ArcCatalog on my system.  There might have been organization network issues (that seemed unrelated) which caused a disruption in being able to connect to ESRI's public server.
0 Kudos
J_B__K_
New Contributor III
Michael, thank you for your attempts!

Is there anybody who can answer - what is wrong with this short, easy script? What should I do to use this method successfully?
0 Kudos
MichaelVolz
Esteemed Contributor
4Bart:

Here is the response I received from ESRI after I opened an incident:

"Thanks very much for the links and details. I was able to call ListMapServices successfully on 10.0 for one server at the office but not for another one, and I don't know what the difference is in their configuration. This function, however, is no longer supported at 10.1:
  http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000004s000000

Have you tried running Fiddler or other network analysis tool to see if any other details can be obtained?
  http://fiddler2.com/
There could be some restriction due to permissions, group policy, or other network settings."

I hope this info helps you out.
0 Kudos
MichaelVolz
Esteemed Contributor
4Bart:

I think I may have found what your issue is.

I tried running the simple sample script from a machine remote from the AGS server that had ArcMap v10.0 sp4 installed on it.  I received the same error message as you.  I then tried running the simple script on the AGS server itself and it worked as expected.

I then tried to create an Admin connection to the AGS server from the remote machine using ArcCatalog.  This connection failed as per this document:

http://support.esri.com/en/knowledgebase/techarticles/detail/39475

It seems that this is a problem with a Windows 2008 Server.  If this is the same scenario for you, you could try upgrading the machine you are running the script from to Windows 7.
0 Kudos