Hello
I have a strange problem with printing tool.
I have an ASP.NET MVC application that displays a map using Esri's ArcGIS for JavaScript, 3.23 and I am using Print templates with esri.request. Geoprocessing Service is synchronous. I want to print the map and all visible layers using Export Web Map Task on our ArcGIS server 10.6.
Map services are on the same server as the PrintingTools service. Layers are public and the firewall is disabled.
I am able to print web map from inside our network, but the problem appears when I am trying to print externally. Outside our network print works only when the visible layer is ESRI’s base map. Esri’s print is able to print my feature layers and also my print is able to print Esri’s feature layers.
The error message is as follows:
error:{code: 400, message: "Unable to complete operation.", details: ["Error executing tool."]} code:400 details:["Error executing tool."] 0:"Error executing tool." message:"Unable to complete operation."
In the Log there is the following message:
Layer "Msaqartvelo": Failed to create layer from service at http://XX.XX.XX:6080/arcgis/rest/services/XXX/XXXXMapService/MapServer/17. Failed to execute (ExportWebMap). Failed to execute (Export Web Map).
In the browser console there is the following message:
Error: Unable to complete operation.
at Object.k.load (init.js:1007)
at init.js:87
at c (init.js:103)
at d (init.js:103)
at b.Deferred.resolve.callback (init.js:105)
at c (init.js:104)
at d (init.js:103)
at b.Deferred.resolve.callback (init.js:105)
at init.js:92
at h (init.js:107)
I have tried different ArcGIS server versions, also publishing from ArcPro 2.1 but I have no luck in this, error messages are all same.
Any help is highly appreciated. Thanks
How are you seeing the service in the map if you're not on the internal network? I assume port 6080 is not accessible outside of your network, so that layer shouldn't render in the map at all.
Anyway, the request is all server side, so i'm surprised it's not working. You can try to run Fiddler on the Server machine as the user running the Server service which will show you all of the outbound requests it's making. That may help identify the problem.
Hi Jonathan
The server is configured to work outside and inside as well. so we have forwarded 6080 ports to the server. the layers are viable from global network.
Encountering the same issue with 10.6. We first noticed the day of the the AGOL update when our jobs that created pngs from the Utility Export Web Map Task began failing. In 10.6, it appears something is different in the print_task that hasn't been made clear.
Running Fiddler as the user running the ArcGIS Server Windows service on the Server machine is the easiest and fastest way to see why print tasks are failing. Any print request tells Server to make outbound requests to whatever URLs are supposed to be included in the output. These requests will be captured by Fiddler if it's run as the ArcGIS Server Windows service, and from there, you can identify why the request is failing.
Found the issue: apparently, starting in 10.6, print services can't accept formatted JSON anymore.
Using the AGOL print utility (https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%...) to print one of the default Esri basemaps (https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer), I've detailed the steps to reproduce.
If you input the following for the following fields:
Web Map as JSON:
{"mapOptions":{"showAttribution":false,"extent":{"xmin":-9188433.447264595,"ymin":4078001.238695625,"xmax":-8736843.484155992,"ymax":4346753.830146175,"spatialReference":{"wkid":102100,"latestWkid":3857}},"spatialReference":{"wkid":102100,"latestWkid":3857},"scale":1155581.108577},"operationalLayers":[{"id":"World_Street_Map_417","title":"World_Street_Map_417","opacity":1,"minScale":0,"maxScale":0,"url":"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"}],"exportOptions":{"outputSize":[946,575],"dpi":96}}
Format:
png32
Layout Template:
map_only
The print job works like a charm, however, if you format the JSON, the job will fail:
Web Map as JSON:
{
"mapOptions":{
"showAttribution":false,
"extent":{
"xmin":-9188433.447264595,
"ymin":4078001.238695625,
"xmax":-8736843.484155992,
"ymax":4346753.830146175,
"spatialReference":{
"wkid":102100,
"latestWkid":3857
}
},
"spatialReference":{
"wkid":102100,
"latestWkid":3857
},
"scale":1155581.108577
},
"operationalLayers":[
{
"id":"World_Street_Map_417",
"title":"World_Street_Map_417",
"opacity":1,
"minScale":0,
"maxScale":0,
"url":"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
}
],
"exportOptions":{
"outputSize":[
946,
575
],
"dpi":96
}
}
Format:
png32
Layout Template:
map_only
Same behavior exists against sampleserver6 :
Execute Task (Export Web Map Task) <-- fails
Execute Task (Export Web Map Task) <-- works
Even using the single-tab format shown on the Esri Documentation Site fails:
Execute Task (Export Web Map Task)
Can anyone confirm that formatting JSON yields an "invalid JSON" error at 10.6 for them as well? Seems like a pretty significant problem.
I can reproduce that here as well. I'd suggest you contact Support to get a bug logged.
Logging now -- will post the bug number here and on my original post!
Hi Andrew,
I am also having this problem.
Did you manage to find a solution?
After talking with customer support, they informed me that, in 10.6, the print service cannot handle any formatting beyond a single blocked text. An existing enhancement request is out there to fix the esri documentation page (ENH-000112648) to no longer show formatting.
I've requested a bug also be submitted as, while updating the documentation page will ensure the functionality matches the documentation, ultimately I believe that the print service should be able to handle formatted JSON, as it has done for the last decade or so at least .
When I get the bug number, I'll post it here