I am trying to configure the print widget available within the Web AppBuilder (which comes with ArcGIS Portal 10.7.1) and it does not work when there is a secured map service inside the webmap.
Background:
1. Have tried to use ArcMap to publish a custom print service with credentials embedded, this seems to work fine for secured service. But, the vector tile from the webmap disappears.
2. Have tried to publish a custom print service from ArcGIS Pro..work fine so long as there is no secured service in the webmap else comes up with an error.
please check whether the following docs help:
Print maps that contain secured services—Documentation (10.7) | ArcGIS Enterprise
Hi Tanu,
Thank you for writing back to me, i explored few options as suggested in the above links.
These things did not work for me.
1. ImportCredentials into the GP-- even if this would have worked i do not prefer embedding credentials into the GP.
and i had difficulty in creating an .ags file with saved password inside pro. In order to do this, i had to use ArcMap...which again is a workflow i prefer not to use any more.
2. The python code provided in Web map printing with arcpy.mp—ArcPy | ArcGIS Desktop did not honor dynamic parameters in the layout.
Here is what i ended up doing.
1. Made a copy of the Export Web Map python.
2. Wrote a method to generate token from the portal.
3. Manipulated the webmap json which comes as input.
#######################
token = generateToken(username,password,portalUrl)
webMapJson = json.loads(WebMap_as_JSON)
for op in webMapJson["operationalLayers"]:
op["token"] = token
result = arcpy.mp.ConvertWebMapToArcGISProject(json.dumps(webMapJson), layoutTemplate)
##################
4. Followed the instructions in Share a print service web tool with custom layouts from ArcGIS Pro—Documentation (10.7) | ArcGIS Ent...
5. And published the modified Export Web Map python as a geoprocessing tool
and it seemed to work for me....
So, until there is an OOB way to do this within the Web App Builder or changes in the Export Web Map tool supplied with the ArcGIS Pro, i do not see a way to print secured service or you may suggest an alternative
Sandeep
Hi @SandeepKuniel1,
I'm looking to copy your workaround.
Are you saying that copied the Export Web Map & Get Layout Templates Info tools into a python script then added this token code to it?
import arcpy
import os
import uuid
token = generateToken(username,password,portalUrl)
webMapJson = json.loads(WebMap_as_JSON)
for op in webMapJson["operationalLayers"]:
op["token"] = token
result = arcpy.mp.ConvertWebMapToArcGISProject(json.dumps(webMapJson), layoutTemplate)
arcpy.server.ExportWebMap(Web Map as JSON, Output, Format, Layout Templates Folder, Layout Template)
import arcpy
arcpy.server.GetLayoutTemplatesInfo(Layout Templates Folder)
Sandeep, which basemap were you using with your custom print service? I created print service with credential embedded for my secured map services. I just recently found out that my print service can't work with some of ESRI default basemap URLs in http://services.arcgisonline.com/ArcGIS/rest/services, but work for URLs with https://basemaps.arcgis.com/arcgis/rest/services
Hi Pei,
We have our own vector tile basemap which is shared across the organization.
So, the basemap was never the issue for the print GP, the problems came with the operational layers added to the webmap
-Sandeep