7

EDIT :

I replaced the url to my arcgis server by the IP address and everything worked. It was probably a problem with the web adaptor.

I am trying to print a map that I made with ArcGIS Server 10.2 and ArcGIS javascript API. If I remove the layers from ArcGIS Server it works (with ESRI basemap)

The problem is that I keep getting an error (code: 400, message: "Unable to complete operation.", details: Array[1], log: undefined, httpCode: 400).

which is more specifically -->

Unable to complete operation.
Error executing tool.: Layer "graphicsLayer8": Failed to create layer from service at http://MYSERVER.com/arcgis/rest/services/Tests/MyFirstMapService/MapServer/2. Layer "graphicsLayer9": Failed to create layer from service at http://MYSERVER.com/arcgis/rest/services/Tests/MyFirstMapService/MapServer/2. Layer "graphicsLayer10": Failed to create layer from service at http://MYSERVER.com/arcgis/rest/services/Tests/MyFirstMapService/MapServer/0. Failed to execute (Export Web Map). Failed to execute (Export Web Map Task).

I get the error if I try to do it via my web server or directly off the ArcGIS Server by doing :

 http://MYSERVER.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task/execute?Web_Map_as_JSON=%7B%22mapOptions%22%3A%7B%22showAttribution%22%3Atrue%2C%22extent%22%3A%7B%22xmin%22%3A-9023064.378303602%2C%22ymin%22%3A5567074.228631147%2C%22xmax%22%3A-6082990.5223433655%2C%22ymax%22%3A7675513.216848888%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%2C%22scale%22%3A9244648.868617998%7D%2C%22operationalLayers%22%3A%5B%7B%22id%22%3A%22layer0%22%2C%22title%22%3A%22layer0%22%2C%22opacity%22%3A1%2C%22minScale%22%3A591657527.591555%2C%22maxScale%22%3A1128.497176%2C%22url%22%3A%22http%3A%2F%2Fservices.arcgisonline.com%2FArcGIS%2Frest%2Fservices%2FWorld_Street_Map%2FMapServer%22%7D%2C%7B%22id%22%3A%22graphicsLayer8%22%2C%22title%22%3A%22graphicsLayer8%22%2C%22opacity%22%3A1%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%2C%22layerDefinition%22%3A%7B%22drawingInfo%22%3A%7B%22renderer%22%3A%7B%22type%22%3A%22simple%22%2C%22symbol%22%3A%7B%22color%22%3Anull%2C%22outline%22%3A%7B%22color%22%3A%5B46%2C46%2C46%2C255%5D%2C%22width%22%3A3%2C%22type%22%3A%22esriSLS%22%2C%22style%22%3A%22esriSLSSolid%22%7D%2C%22type%22%3A%22esriSFS%22%2C%22style%22%3A%22esriSFSSolid%22%7D%7D%7D%7D%2C%22url%22%3A%22http%3A%2F%2FMYSERVER.com%2Farcgis%2Frest%2Fservices%2FTests%2FMyFirstMapService%2FMapServer%2F2%22%7D%2C%7B%22id%22%3A%22graphicsLayer9%22%2C%22title%22%3A%22graphicsLayer9%22%2C%22opacity%22%3A0%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%2C%22layerDefinition%22%3A%7B%22drawingInfo%22%3A%7B%22renderer%22%3A%7B%22type%22%3A%22simple%22%2C%22symbol%22%3A%7B%22color%22%3A%5B46%2C46%2C46%2C255%5D%2C%22outline%22%3A%7B%22color%22%3A%5B46%2C46%2C46%2C255%5D%2C%22width%22%3A3%2C%22type%22%3A%22esriSLS%22%2C%22style%22%3A%22esriSLSSolid%22%7D%2C%22type%22%3A%22esriSFS%22%2C%22style%22%3A%22esriSFSSolid%22%7D%7D%7D%7D%2C%22url%22%3A%22http%3A%2F%2FMYSERVER.com%2Farcgis%2Frest%2Fservices%2FTests%2FMyFirstMapService%2FMapServer%2F2%22%7D%2C%7B%22id%22%3A%22graphicsLayer10%22%2C%22title%22%3A%22graphicsLayer10%22%2C%22opacity%22%3A1%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%2C%22layerDefinition%22%3A%7B%22drawingInfo%22%3A%7B%22renderer%22%3A%7B%22type%22%3A%22simple%22%2C%22label%22%3A%22%22%2C%22description%22%3A%22%22%2C%22symbol%22%3A%7B%22color%22%3A%5B204%2C64%2C57%2C255%5D%2C%22size%22%3A8%2C%22angle%22%3A0%2C%22xoffset%22%3A0%2C%22yoffset%22%3A0%2C%22type%22%3A%22esriSMS%22%2C%22style%22%3A%22esriSMSSquare%22%2C%22outline%22%3A%7B%22color%22%3A%5B120%2C64%2C61%2C255%5D%2C%22width%22%3A0.25%2C%22type%22%3A%22esriSLS%22%2C%22style%22%3A%22esriSLSSolid%22%7D%7D%7D%7D%7D%2C%22url%22%3A%22http%3A%2F%2FMYSERVER.COM%2Farcgis%2Frest%2Fservices%2FTests%2FMyFirstMapService%2FMapServer%2F0%22%7D%2C%7B%22id%22%3A%22map_graphics%22%2C%22opacity%22%3A1%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%2C%22featureCollection%22%3A%7B%22layers%22%3A%5B%5D%7D%7D%5D%2C%22exportOptions%22%3A%7B%22outputSize%22%3A%5B800%2C1100%5D%2C%22dpi%22%3A96%7D%2C%22layoutOptions%22%3A%7B%22titleText%22%3A%22Un+titre%22%2C%22authorText%22%3A%22MSSS%2C+Direction+de+la+gestion+int%C3%A9gr%C3%A9e+de+l%27information.%22%2C%22copyrightText%22%3A%22%3Ccopyright+info+here%3E%22%2C%22scaleBarOptions%22%3A%7B%22metricUnit%22%3A%22esriKilometers%22%2C%22metricLabel%22%3A%22km%22%2C%22nonMetricUnit%22%3A%22esriMiles%22%2C%22nonMetricLabel%22%3A%22mi%22%7D%2C%22legendOptions%22%3A%7B%22operationalLayers%22%3A%5B%5D%7D%7D%7D&Format=PDF&Layout_Template=A3+Landscape&env%3AoutSR=&env%3AprocessSR=&returnZ=false&returnM=false&f=html

I guess that means it's not a proxy or CORS problem.

Here's the code for the printing part :

printUrl = "http://MySERVER.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
 var printInfo = esriRequest({
 "url": printUrl,
 "content": { "f": "json" }
 });
 printInfo.then(dojo.hitch(printUrl,dojo.hitch(myMap,handlePrintInfo)), handleError);
 function handlePrintInfo(resp) {
 var layoutTemplate, templateNames, mapOnlyIndex, templates;
 layoutTemplate = arrayUtils.filter(resp.parameters, function(param, idx) {
 return param.name === "Layout_Template";
 });
 if ( layoutTemplate.length === 0 ) {
 console.log("print service parameters name for templates must be \"Layout_Template\"");
 return;
 }
 templateNames = layoutTemplate[0].choiceList;
 // remove the MAP_ONLY template then add it to the end of the list of templates 
 mapOnlyIndex = arrayUtils.indexOf(templateNames, "MAP_ONLY");
 if ( mapOnlyIndex > -1 ) {
 var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0];
 templateNames.push(mapOnly);
 }
 // create a print template for each choice
 templates = arrayUtils.map(templateNames, function(ch) {
 var plate = new PrintTemplate();
 plate.layout = plate.label = ch;
 plate.format = "PDF";
 plate.layoutOptions = { 
 "authorText": "Author.",
 "copyrightText": "<copyright info here>",
 "legendLayers": [], 
 "titleText": "A title", 
 "scalebarUnit": "Kilometers" 
 };
 return plate;
 });
 // create the print dijit
 var printer = new Print({
 "map": myMap,
 "templates": templates,
 "url": printUrl
 }, dojo.byId("print_button"));
 printer.startup();
 }
 function handleError(err) {
 console.log("Something broke: ", err);
 }`
asked Oct 22, 2014 at 12:48
6
  • Are those feature services secured, or require a user name and password to access them through ArcGIS Server? Feature Services behind token security would require tokens to be added to the print task call. Commented Oct 22, 2014 at 14:13
  • These feature services are NOT secured Commented Oct 22, 2014 at 14:43
  • are you referring to the print server the same way you refer to your graphicsLayers within your webmap JSON? (ie: do both of the urls contain 'tcn00qubc01341:6080' Commented Oct 23, 2014 at 16:58
  • @John Gravois - Yes. Commented Oct 23, 2014 at 17:22
  • tough to say, there's a ton going on in your webmap json. i'd recommend adding in layers on at a time to see if one in particular is the problem. Commented Oct 23, 2014 at 18:05

1 Answer 1

3

I changed the URL call to my arcgis server to the ip address and the map finally prints. Probably a problem with the web adaptor.

answered Nov 25, 2014 at 13:11
1
  • Do we know the issue with the web adapter that cause this? We are experiencing the same issue. Commented Mar 1, 2023 at 17:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.