AnsweredAssumed Answered

Print Tool not working in WAB 2.6

Question asked by shaikhrizuan on Mar 27, 2018

Hi,

 

I am trying to print map using the below code-

var legendLayer = new LegendLayer();
legendLayer.layerId = this.map.layerIds[1];
legendLayer.subLayerIds = [0,1];
// legendLayer.subLayerIds = [1];
var url = "https://MachineName:6443/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
var printTask = new PrintTask(url);
var params = new PrintParameters();
var template = new PrintTemplate();
template.format = "PDF";
template.layout = "A4 Landscape";
template.layoutOptions = {"legendLayers": [legendLayer], // empty array means no legend
"titleText": "Map Print",
"authorText": "Insight",
"copyrightText": "LTI",
"scalebarUnit": "Kilometers"};
template.preserveScale = false;
debugger;
template.exportOptions = {
width:30,
height:60,
dpi:96
};
params.map = this.map;
params.template = template;
printTask.on("error",lang.hitch(this, this._printResultError));
printTask.execute(params, lang.hitch(this, this._printResult));

}

The above code works fine in for WAB 2.5 using ArcGIS JavaScript API 3.21 with dynamic Map service Layer as a basemap. Please find below image for the same without any error any console window

Success

Whereas same code, with WAB 2.6 using ArcGIS JavaScript API 3.22 with tiled  map service as a basemap is not working.Please find image below

Error

I found that the request for WAB 2.5 serves GET request, whereas WAB 2.6 serves POST request by default. Also when i check server manager logs it s saying "error 000735: web map as JSON:Value is required". Please find below image-

ArcGIS Server Manage logs

 

How to resolve this issue?? 

 

Thanks,

Shaikh

Outcomes