Custom Print service with secured service

07-25-2017 06:53 AM
Occasional Contributor


I was trying to create a custom Print Service to use with the ArcGIS API (Print task). I made my own python toolbox using ConvertWebMapToMapDocument. I added my arcgis connection file (.ags) to the "extra_conversion_options"  parameter of the tool.

The ags file is the exact same one that I used to create a Print service using the built-in toolbox from ESRI, and this print service is working well.

I stored it under one of my registered folder on the server.

The toolbox compiles and works fine locally (it does not ask for credentials). However whatever I do, when it is published as a service, I always get an error :

"RuntimeError: Layer "....": Unable to connect to map server at "

Even weirder, some of the feature services I add to the map, seem to print ok while most don't. They are all secured the same way, and stored at the same place.

0 Kudos
3 Replies
Occasional Contributor

2 years later and I still have the issue.

It seems I am unable to use extra_conversion_options with ConvertWebMapToMapDocument, which prevents me from printing secured services...

Any ideas?

0 Kudos
Esri Regular Contributor

Hi Matthieu, sorry to hear about the trouble. It sounds like you are publishing a custom print service, from ArcMap to ArcGIS Enterprise, is that correct?

And the custom print service that you published, always throws the error you mentioned, but it also prints some layers, but not others? And all layers are secure. Is that correct?

I'm not sure how to troubleshoot this from an ArcGIS API for JavaScript perspective, but I would like to know ore information to see if I can help and/or reproduce the issue.

I also recommend 2 things:

1) Can you try this same workflow from ArcGIS Pro instead of ArcMap?

Share a print service web tool with custom layouts from ArcGIS Pro—Documentation (10.7) | ArcGIS Ent... 

2) Try posting your question in the ArcGIS Enterprise space, as you may get better results from someone more familiar with publishing services.

0 Kudos
Occasional Contributor

It turns out we just figured it out. It was linked to the way we used to create server connection file, and in particular the way we specified the server URL.

We were typically using either: or 

We had to use instead. This was a simple fix, which took us 2 years to figure out.